diff --git a/3-99 Research/Rust/Chapter 1 - Introduction.md b/3-99 Research/Rust/Chapter 1 - Introduction.md index 7e35ca0b8..163bf4c14 100644 --- a/3-99 Research/Rust/Chapter 1 - Introduction.md +++ b/3-99 Research/Rust/Chapter 1 - Introduction.md @@ -30,3 +30,24 @@ Fourth, each line ends with a semicolon. Much like C. # Cargo! Cargo is Rust's dependency manager and project creator. Using "cargo new xxx" will create a new project in a folder xxx. + +Cargo build will compile and build things. +Cargo run will do build and then run the program! + +Cargo check will compile everything and check for errors, but won't build an executable yet. + +Cargo uses a .toml to manage everything. This is what one of those looks like: + +```toml +[package] +name = "hello_cargo" +version = "0.1.0" +edition = "2021" + +[dependencies] +``` + +This file makes sures that when building all the right dependencies and their versions are in your files. This is great for management of dependencies, and will also help when writing code. + +## Release vs. Debug +When ready to build something for release, use "cargo build --release". This tells the compiler to include optimizations when building the code. This lengthens compile time, but will make the target code faster. Code is then stored in target/release insetead of target/debug.