Languages
Rust
Cargo, ownership and Result-based error handling.
Updated Official documentation ↗
Cargo
cargo new helloCreate a binary projectcargo checkType-check without producing a final executablecargo testRun unit and integration testscargo fmtFormat the projectValues and ownership
let count = 3;Bind an immutable valuelet mut count = 3;Allow reassignment or mutationlet name = String::from("Ada");Own a heap-allocated stringlet borrowed = &name;Borrow without moving ownershipCollections and results
let values = vec![1, 2, 3];Construct a vectorvalues.iter().map(|n| n * 2).collect::<Vec<_>>()Transform borrowed elementsSome(42)Represent an optional valuelet text = std::fs::read_to_string(path)?;Propagate an error from a function returning a compatible Result