Opening page…
Cargo, ownership and Result-based error handling.
cargo new helloCreate a binary projectcargo checkType-check without producing a final executablecargo testRun unit and integration testscargo fmtFormat the projectlet 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 ownershiplet 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