Summary:
Continuing practicing the Rust Syntax. Nothing major. The "do something meaningful day is still in the future"
Rust by Practice
- Learned about "an inner lint attribute that allows the overflowing_literals lint".
- Sometimes the "usual behaviour" can be achieved using unsafe code. Rust wants to protect us.
*mut i32is a raw mutable pointer to ani32.- If we want to use
let u:U = T.into()orlet u: U = U::from(T)we should do the:impl From<T> for U - Learned about the
TryFromandTryIntothat return aResultand can be use for conversions that might fail. - We can shorten and extend the lifetimes with the
transmute maphas normal return inside the closure,and_thenhasResultreturn inside the closure.- A single Cargo package managed by one Cargo.toml can contain multiple crate targets: at most one library crate from src/lib.rs, one default binary crate from src/main.rs usually named after the package, and additional binary crates from files in src/bin/*.rs.
- We can control the visibility of stuff with:
pub(in crate::a) - 12.1: Type Conversion - as
- 12.2: Type Conversion - from/into
- 12.3: Type Conversion - others
- 13.1: Result and panic - panic!
- 13.2: Result and panic - result and ?
- 14.1: Crate and Module - package and crate
- 14.2: Crate and Module - module
- 14.3: Crate and Module - advanced use and pub