How knit-zhang/rust-basic works
Main Components
• Exercise Manager: Represent the core logic that drives the learning experience. This includes modules in the src directory such as main.rs, run.rs, verify.rs, exercise.rs, project.rs, and ui.rs. These files together form the CLI tool that navigates, executes, and tests the exercises.
• Exercises Repository: Emphasize the “exercises” folder, which is organized into subdirectories for topics (e.g., generics, hashmaps, iterators, lifetimes, macros, etc.). Each topic’s folder has its own README file and multiple exercise files (e.g., generics1.rs, hashmaps1.rs, etc.) that the exercise manager loads and verifies.
• Testing and CI Infrastructure: Include the “tests” folder that contains integration tests, fixtures for simulating various exercise states and error conditions, and the GitHub workflows (in .github/workflows) that drive CI for automatic verification. Also, note configuration files like Cargo.toml, Cargo.lock, and several CI-related files (.github/result, .github/classroom).
• Development Environment & Tooling: Identify ancillary configurations—such as the .devcontainer, .vscode, shell.nix, flake.nix, and other environment setup scripts along with docs (CHANGELOG, CONTRIBUTING, AUTHORS) that enable consistent development, local testing, and deployment across various environments (Linux, MacOS, Windows, Codespaces).
Out the Relationships and Data Flow
• The manager then invokes the Testing framework (via functions in verify.rs and integration tests) to check whether exercises pass. Illustrate this as a bidirectional flow between the “Exercise Runner” and the “Testing/CI Infrastructure”.
• The development environment components are “helper modules” that provide configurations for local containerized setups, editors, and shell environments.
Architectural Patterns and Design Principles
• Separation of Concerns: The project splits responsibilities between the CLI tool (running, verifying, providing hints) and the content (exercises organized by topic).
• Modular Structure: The src directory’s multiple modules indicate a layered design—UI, execution, verification—each with a clear role.
• Extensibility: The modular approach in the “exercises” folders fosters easy addition of new topics and exercises.
• Testing & CI: Automated testing components reinforce a test-driven flow where code changes are immediately validated via CI pipelines.
Relevant Technologies
• Rust language specifics: Cargo (for package management), along with Rust’s testing framework.
• Git and GitHub: Source control plus GitHub Classroom and GitHub Actions for CI.
• Containerization and development environment configuration: Use of .devcontainer and shell.nix files to standardize development.