- The rust programming language
- More interactive TRPL from Brown
- Easy Rust
- Rust by Example
- Rustlings: Learn rust by solving problems
- Rust Cookbook
- The Rustnomicon: The Dark Arts of Unsafe Rust
- The Little Book of Rust Macros
- The Rust Reference
- Writing an OS in rust
- Rust Atomics and Locks
- A Guide to Contiguous Data in Rust
- How Rust Achieves Thread Safety
- [Video] Rust and RAII Memory Management - Computerphile
- Demystifying Rust’s lazy_static pattern
Box<T>
to allocate from heap.Rc<T>
to share variable among multiple owners without lifetime parametes in a single threaded program. It only allows immutable access to data. Value needs to wrapped inRefCell<T>
if mutability is desired.T.clone()
does a deep copy. Avoid deep copy withRc::clone(&T)
.RefCell<T>
is used to mutate the value inside an immutable value. This is called interior mutability pattern.RefCell<T>
inforces same borrow checking rules in runtime.Arc<T>
to share T among multiple threads.
- Is the data in Vec always densely packed?
- Serialize 'struct' with dynamically sized data to '&[u8]'?
rustup component add rust-analyzer
rustup component add clippy