This is a learning-focused Rust repository containing independent tutorial projects, not a production application. Each subdirectory is a standalone Cargo project demonstrating speci`fic Rust concepts.
- Independent modules: Each directory (
guessing_game/,ownership/,structs/, etc.) is a separate Cargo workspace with its ownCargo.tomlandsrc/main.rs - No shared code: Projects don't import from each other - they're educational examples, not interconnected modules
- Self-contained: Run projects individually with
cargo runfrom their respective directories
common_concepts/: Variables, data types, functions, control flow, loops, temperature conversionownership/: Ownership rules, borrowing, slices with detailed commentsguessing_game/: Interactive CLI withrandcrate dependencytodo-cli/: File I/O example withtodos.txtpersistencesnake_game/: Game usingmacroquadcrate (not actually snake, it's a space shooter)structs/: Struct definitions, methods, builder pattern (build_user)modules/: Module system basics (pub mod kitchen)vectors/: Mutable vector iteration pattern
cd <project_name>
cargo runThe guessing_game/dev.sh script provides auto-reload functionality:
- Uses
cargo watchfor file watching - Type
rsto manually restart,qto quit - Requires
cargo-watchinstalled:cargo install cargo-watch
- Most projects use
edition = "2024"(note: this is unusual, standard is 2021) snake_gameusesedition = "2021"
- Educational comments: Code includes detailed explanations (see
ownership/src/main.rslines 13-18) - Function organization: Multiple example functions called from
main()to demonstrate concepts - Explicit typing: Type annotations used for teaching clarity (e.g.,
let y: i32 = 10) - Emoji in output: CLI tools use emoji for user-friendly messages (
✅,📭,🧹in todo-cli)
- Match for error handling:
match input.trim().parse()pattern in guessing_game - Reference passing:
&Rectanglefor struct methods without ownership transfer - Derive Debug: Use
#[derive(Debug)]for structs +{:#?}pretty-print - Module exports: Use
pub mod+pub fnfor public module APIs
guessing_game/integers.md: Integer type reference (ranges, signed vs unsigned formulas)- Not every project has docs - most are self-explanatory from code
When adding new tutorial projects:
- Create new directory at root level
- Run
cargo initinside it - Follow naming convention: lowercase with underscores
- Add focused examples in
main()- avoid complex abstractions - Include inline comments explaining non-obvious Rust concepts
- Use emoji in CLI output for better UX consistency with existing projects
No test files exist - this is a tutorial repo focused on demonstrating syntax and concepts, not TDD practices.