Hello Cargo
Create a project
Cargo makes a folder with Cargo.toml and src/main.rs.
cargo new hello
cd hello
Read the starter program
main is the entry point. println! is a macro that prints a line.
fn main() {
println!("Hello, World!");
}
Run it
cargo run compiles if needed and executes the binary.
cargo run
Build without running
cargo buildcreates a debug binary intarget/cargo build --releaseoptimizes for speedcargo checktype-checks faster without full codegen- Commit
Cargo.tomland source; ignoretarget/
Comments
One comment per signed-in account. Comments are saved with this page’s URL.