rust is pretty sick


  1. ok wowwie
  2. bg
  3. where yours truli was woo'd
  4. summary
  5. links

ok wowwie

I was writing some companion notes as I was following along with the rust book. I found myself appending screenshot after progressively wowwier screenshot as I played around with cargo doc --open

bg

cargo = rust's build tool & package manager

gives you the following commands

cargo build cargo test cargo doc (!) cargo run (compiles & runs in one step) cargo publish (publishes to )

for global installation of fmt & linting tools:

rustup component add rustfmt ; rustup component add clippy

where yours truli was woo'd

in the lil starter project I used the rand random number generator

use rand::Rng

// etc

let secret_num = rand::thread_rng()
  .gen_range(1, 101);

cargo doc --open will build docs provided by all ur local dependencies; if u are using rand::Rng, you can call the former and click on rand to find out more functionality contained in the crate

altylsyl

then clicking on the methods will reveal trait implementations, methods, etc.

altylsyl

wowwie :ok: !

altylsyl

p.s. there are gorgeous examples for each method :scream:

altylsyl

/ omg it will even show you the source code for any method :gagged:

summary

With the help of cargo doc I quickly was able to peek at other methods available to a pkg, see example uses, see the source code for each, and add them to my own project.

The only docs I've seen that are this good/practically usable are Haskell's (jk!! :smiling:) Ramda's. The diff? Cargo generates them on demand for locally installed crates.

In addition to the v cute design the rust homepage links to the best intro docs and books. Rust by example is a big ole compendium of well written explanations about every feature with lil embedded IDEs on every page.

links