Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# Create a new binary project # $ cargo new hello_cargo # Created binary (application) `hello_cargo` package # Project layout created: # hello_cargo/ # ├── Cargo.toml # └── src/ # └── main.rs # Build (debug) # $ cargo build # Compiling hello_cargo v0.1.0 # Finished dev [unoptimized + debuginfo] target(s) in 1.23s # Run without a separate build step # $ cargo run # Hello, world! # Type-check only (fastest way to catch errors) # $ cargo check # Build with optimisations # $ cargo build --release # Run tests # $ cargo test # Cargo.toml for a typical binary project: [package] name = "hello_cargo" version = "0.1.0" edition = "2021" authors = ["Your Name <you@example.com>"] description = "A demo Cargo project" [[bin]] name = "hello_cargo" path = "src/main.rs" [dependencies] # dependencies go here [dev-dependencies] # test-only dependencies [profile.release] opt-level = 3 lto = true
Result
Open