vault backup: 2025-02-17 16:21:40

This commit is contained in:
Dane Sabo 2025-02-17 16:21:40 -05:00
parent 3e212974b7
commit 48257b9625

View File

@ -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.