Welcome to Schola, the place where we share solutions to the Tonk Curriculum.
Requirements:
- Rust (installation instructions).
- Access to the Tonk Curriculum.
For now, solutions are organized by week and username, but we can change this structure in the future if needed:
week_{{number}}/{{username}}/src/main.rs
Each solution is an independent Rust project, complete with its own Cargo.toml file that manages
dependencies and configurations.
solutions/
└── week_1/
├── goblinoats/
│ └── src/
│ └── main.rs
├── jackddouglas/
│ └── ...
└── arthurgousset/
└── ...
To add your solution for a new week:
-
Initialize a project for the specific week and your username:
$ cargo new --bin solutions/week_{{number}}/{{username}} --vcs noneFor example:
$ cargo new --bin solutions/week_1/arthurgousset --vcs none
-
Write your solution code inside the generated
src/main.rsfile$ cd solutions/week_{{number}}/{{username}} -
Build the project:
$ cargo build
-
Run the project:
$ cargo run
Note
For context:
- the
--binflag specifies that the new project is a binary crate (i.e., it contains an executable). Without this flag, Cargo would create a library crate by default. - the
--vcs noneflag specifies that the new project should not be initialized with version control. We're managing version control at the repository level, so we don't need it at the project level.
To keep the repository clean and organized, I propose the following guidelines:
- Create a branch for each new week:
{{username}}/week_{{number}}/(e.g.arthurgousset/week_1).$ git checkout -b {{username}}/week_{{number}} - Commit your changes to the branch.
- Open a pull request to merge your branch into
mainwhen you're ready to submit your solution. Merge the PR using "squash and merge". That'll keep the commit history onmainnice and tidy.
This ensures that each solution is isolated and can be reviewed independently.
