My learning resources on rust:
cargo
manages projects
rustup
manages rust installations
cargo doc --open
-> auto generates documents
cargo build --release
-> the resulting output would go into release folder
- If the size of the variable is known the the variable is stored in stack
- If the size is dynamic, the variable is stored in heap.
- rustc first allocates a memory in the heap and gives the address of the memory, which is then stored in a stack.
::
path operator
<>
turbo fish operator or angel brackets
string
can be cleared.- borrowing in rust is more or less same as referencing
use rand::prelude::*
-> imports all basic fucntions from the crate- in rust
method
andfunctions
are different. Methods are functions for a struct. - method will always have
self
as first argument.
The borrow checker is the component in the Rust compiler that enforces data ownership rules, and it enforces these to prevent data races