diff options
| author | mo8it <mo8it@proton.me> | 2025-05-17 21:25:19 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2025-05-17 21:25:19 +0200 |
| commit | a51d6f1309b986c270d781b08f6949f29806b18a (patch) | |
| tree | 6997dec2af185002920f26a1f3aa87746d3e24a8 /website/content/community-exercises | |
| parent | f6a657a0c3628d75dae7cd1d3a822dc19d379f15 (diff) | |
third-party/custom -> community
Diffstat (limited to 'website/content/community-exercises')
| -rw-r--r-- | website/content/community-exercises/index.md | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/website/content/community-exercises/index.md b/website/content/community-exercises/index.md new file mode 100644 index 0000000..1c8cd57 --- /dev/null +++ b/website/content/community-exercises/index.md @@ -0,0 +1,65 @@ ++++ +title = "Community Exercises" ++++ + +Do you want to create your own set of Rustlings exercises to focus on some specific topic? +Or do you want to translate the original Rustlings exercises? + +## List of Community Exercises + +- 🇯🇵 [Japanese Rustlings](https://github.com/sotanengel/rustlings-jp):A Japanese translation of the Rustlings exercises. +- 🇨🇳 [Simplified Chinese Rustlings](https://github.com/SandmeyerX/rustlings-zh-cn): A simplified Chinese translation of the Rustlings exercises. + +You can use the same `rustlings` program that you installed with `cargo install rustlings` to run them + +The support of Rustlings for community exercises allows you to create your own set of Rustlings exercises to focus on some specific topic. +You could also offer a translation of the original Rustlings exercises as community exercises. + +## Getting started + +To create community exercises, install Rustlings and run `rustlings dev new PROJECT_NAME`. +This command will, similar to `cargo new PROJECT_NAME`, create a template directory called `PROJECT_NAME` with all what you need to get started. + +Read the comments in the generated `info.toml` file to understand its format. +It allows you to set a custom welcome and final message and specify the metadata of every exercise. + +## Create an exercise + +Here is an example of the metadata of one file: + +```toml +[[exercises]] +name = "intro1" +hint = """ +To finish this exercise, you need to … +This link might help you …""" +``` + +After entering this in `info.toml`, create the file `intro1.rs` in the `exercises/` directory. +The exercise needs to contain a `main` function, but it can be empty. +Adding tests is recommended. +Look at the official Rustlings exercises for inspiration. + +You can optionally add a solution file `intro1.rs` to the `solutions/` directory. + +Now, run `rustlings dev check`. +It will tell you about any issues with your exercises. +For example, it will tell you to run `rustlings dev update` to update the `Cargo.toml` file to include the new exercise `intro1`. + +`rustlings dev check` will also run your solutions (if you have any) to make sure that they run successfully. + +That's it! +You finished your first exercise 🎉 + +## Publish + +Now, add more exercises and publish them as a Git repository. + +Users just have to clone that repository and run `rustlings` in it to start working on your set of exercises just like the official ones. + +One difference to the official exercises is that the solution files will not be hidden until the user finishes an exercise. +But you can trust the users to not look at the solution too early 😉 + +## Share + +After publishing your set of exercises, open an issue or a pull request in the official Rustlings repository to link to your project in the README 😃 |
