Weird Rust stuff documented.
-
There is no null in Rust!
Instead, there is
None
, and there is:enum Option<T>{ Some(T), None }
-
String
AsRef<Path>
Why the heck
String
has a responsibility forPath
... -
Why Rust doesn't allow marking only some struct fields mutable?
Each field is in a different memory location. However, the struct is a type. So, when using it, we can't know which part of the struct's instance that the other code is going to use.
-
I couldn't grasp how to run multiple files together from get-go
src/main.rs:
mod vectors; fn main() { vectors::run_vectors(); }
src/vectors.rs:
pub fn run_vectors() { println!("vectors!"); }
-
String concatenation uses the buffer of the origin string
This is a good thing as in the op below, Rust will copy str2 to str1's buffer.
let str3 = str1 + &str2;
-
People can add their own hashers to stdlib's HashMap implementation
Check out them here.