Rust links¶
Cargo recognises semantic versioning
crates.io “Crates.io is where people in the Rust ecosystem post their open source Rust projects for others to use.”
The rust programming language book¶
The rust book calls rust programmers ‘rustaceans’.
Chapter 1 is an introduction to the basic tools, including cargo and the installation of the tools.
Chapter 2 starts a ‘guessing game’ program. This starts by using simple input/output with the std::io package.
There is a few examples of ‘cargo’ when one starts using the rand::Rng package, including the commands ‘cargo doc’, ‘cargo build’, ‘cargo update’.
The documentation example:
cargo doc --open
Chapter 4 talks about ownership, the very special rust concept:
Each value in rust has an owner
There can only be one owner at a time
When the owner goes out of scope, the value will be dropped.
Other things discussed are cloning, the Copy trait of a type, the drop method (that implements the Drop trait).
For function calls, passing a variable to a function will move or copy, just as assignment does.
The section on references explains the method as a way to avoid the (protocol) of getting ownership when entering a function and returning ownership on function return.
Normal references are not mutable. Adding mut changes the reference to mutable reference. Mutable references have one big restriction: if you have a mutable reference to a value, you can have no other references to that value.
Rust prevents the problem of data races by refusing to compile code with data races!
Rules of references:
you can have either one mutable reference (read/write) or any number of immutable references. (Swimmer, single write, multiple read).
references must be always valid - rust checks this with lifetimes [5] and ownership.
Rust (wikipedia), this includes a video in webm by Emily Dunham at linux.conf.au in 2017.
The Rust Standard Library [4] .. The Rust Standard Library: https://doc.rust-lang.org/nightly/std/index.html
Emily Dunham “Should you rewrite in Rust?” (youtube) (45 min) LinuxConfAu 2018, Sydney
http://talks.edunham.net/lca2018/should-you-rewrite-in-rust/
Footnotes