# JAVASCRIPT RUST
# npm => cargo
# package.json => Cargo.toml
# package-lock.json => Cargo.toml
# pacakges => crates
<aside> 💡 A Rust crate is either a library or an executable program, referred to as either a library crate or a binary crate.
</aside>
# init new rust project
# --bin (binary crate) : creates src/main.rs, DEFAULT OPTION
# --lib (library crate) : creates src/lib.rs
cargo new my-binary-crate
cargo new my-binary-crate --vcs none # omit creating git repository
cargo new my-library-crate --lib
# compiles program to a single executable that is named after the
# projects name (defined in Cargo.toml)
# puts it in the newly created target folder
cargo build --debug # target => /debug, fast compilation, slow program
cargo build --release # target => /release, slow compiltation, fast program
# build a local documentation of all your creates used
cargo doc --open
# other commands
cargo --version # get version number
which cargo # shows where on the disc cargo is installed
cargo add
command<aside>
💡 If you like to use cargo add <package-name>
instead of manually specifying in the Cargo.toml
file, then you can download the tool cargo-edit
</aside>
<aside> ℹ️ Download cargo-edit: https://github.com/killercup/cargo-edit
</aside>