Wednesday, January 28, 2026

Second 4 months of Rust

Macros

CLAP

Using Clippy

Std...

Reading the pages .....traits defined, Enums, Structs .... and (generic) definitions of the trait for EXTERNAL types. That's why it's listed there, not in the page of those types.
 
Any .....using 
 intrinsics::type_id::<T>()

HashMap ...

 Tricking the HashMap | Ivan Dubrov 

 

!Sized

Generics parameters implicitly constrained to Sized
 

- iterators

-  

Error handling

Option -> Result

std::Result

? expands to ..... return Err(From::from(e)) 

Defining new error types out of lower-level ones:

#[non_exhaustive]

thiserror   -> 

 

#[derive(Error)]

      #[error("message")] 

      ....#[from:] ... 

 


and we can use  derive_more::Error 

Error trait enables the nesting: 

  • source()
  • provide()   default to None, but can be implemented   

  

YT: A Simpler Way to See Results

 

Anyhow:

https://docs.rs/anyhow/latest/anyhow/index.html

 

 

No comments:

Post a Comment