This is a Rust learning workspace, as indicated by the README.md and the project structure. The repository is organized into directories named day1, day2, etc., with each directory containing small, standalone Rust programs that explore a specific language feature.
The Cargo.toml file is configured to define multiple binary targets. Each .rs file is treated as a separate executable application. This setup is tailored for learning and allows each example to be built and run independently.
Because this project contains multiple applications, you need to specify which one you want to run.
To build all the example programs at once, run:
cargo buildThis will compile all binaries into the target/debug/ directory.
To run a specific program, use the cargo run --bin <binary_name> command. The binary name is defined by the name field in the [[bin]] section of the Cargo.toml file.
For example:
- To run
greetings.rsfrom day 1:cargo run --bin greetings
- To run
scope.rsfrom day 2:cargo run --bin scope
- To run
shadowing.rsfrom day 3:cargo run --bin shadowing
While there are currently no tests, you can run tests for the workspace using the standard command:
cargo test- Structure: Each concept or lesson is contained within its own
.rsfile and is defined as a separate[[bin]]target inCargo.toml. - Self-Contained Examples: Each file is a small, self-contained program with a
mainfunction, designed to demonstrate a specific Rust concept clearly and concisely. - Focus: The code focuses on fundamental Rust features like variable bindings, scope, shadowing, and basic types.