mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-05-31 23:09:44 +02:00
third-party/custom -> community
This commit is contained in:
parent
f6a657a0c3
commit
a51d6f1309
10
CHANGELOG.md
10
CHANGELOG.md
@ -16,7 +16,7 @@
|
||||
- New option `x` in the prompt to reset the file of the current exercise 🔄
|
||||
- Allow `dead_code` for all exercises and solutions ⚰️ (thanks to [@huss4in](https://github.com/huss4in))
|
||||
- Pause input while running an exercise to avoid unexpected prompt interactions ⏸️
|
||||
- Limit the maximum number of exercises to 999. Any third-party exercises willing to reach that limit? 🔝
|
||||
- Limit the maximum number of exercises to 999. Any community exercises willing to reach that limit? 🔝
|
||||
|
||||
### Changed
|
||||
|
||||
@ -93,7 +93,7 @@
|
||||
|
||||
#### Added
|
||||
|
||||
- `dev check`: Check that all exercises (including third-party ones) include at least one `TODO` comment.
|
||||
- `dev check`: Check that all exercises (including community ones) include at least one `TODO` comment.
|
||||
- `dev check`: Check that all exercises actually fail to run (not already solved).
|
||||
|
||||
#### Changed
|
||||
@ -168,13 +168,13 @@ This should avoid issues related to the language server or to running exercises,
|
||||
Clippy lints are now shown on all exercises, not only the Clippy exercises 📎
|
||||
Make Clippy your friend from early on 🥰
|
||||
|
||||
### Third-party exercises
|
||||
### Community Exercises
|
||||
|
||||
Rustlings now supports third-party exercises!
|
||||
Rustlings now supports 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?
|
||||
Then follow the link to the guide about [third-party exercises](THIRD_PARTY_EXERCISES.md)!
|
||||
Then follow the link to the guide about [community exercises](https://rustlings.rust-lang.org/community-exercises)!
|
||||
|
||||
## 5.6.1 (2023-09-18)
|
||||
|
||||
|
@ -315,7 +315,7 @@ impl AppState {
|
||||
}
|
||||
|
||||
// Official exercises: Dump the original file from the binary.
|
||||
// Third-party exercises: Reset the exercise file with `git stash`.
|
||||
// Community exercises: Reset the exercise file with `git stash`.
|
||||
fn reset(&self, exercise_ind: usize, path: &str) -> Result<()> {
|
||||
if self.official_exercises {
|
||||
return EMBEDDED_FILES
|
||||
@ -385,7 +385,7 @@ impl AppState {
|
||||
}
|
||||
|
||||
/// Official exercises: Dump the solution file from the binary and return its path.
|
||||
/// Third-party exercises: Check if a solution file exists and return its path in that case.
|
||||
/// Community exercises: Check if a solution file exists and return its path in that case.
|
||||
pub fn current_solution_path(&self) -> Result<Option<String>> {
|
||||
if cfg!(debug_assertions) {
|
||||
return Ok(None);
|
||||
|
@ -8,7 +8,7 @@ mod update;
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum DevCommands {
|
||||
/// Create a new project for third-party Rustlings exercises
|
||||
/// Create a new project for community exercises
|
||||
New {
|
||||
/// The path to create the project in
|
||||
path: PathBuf,
|
||||
|
@ -86,10 +86,10 @@ target/
|
||||
";
|
||||
|
||||
const INFO_FILE_BEFORE_FORMAT_VERSION: &str =
|
||||
"# The format version is an indicator of the compatibility of third-party exercises with the
|
||||
"# The format version is an indicator of the compatibility of community exercises with the
|
||||
# Rustlings program.
|
||||
# The format version is not the same as the version of the Rustlings program.
|
||||
# In case Rustlings makes an unavoidable breaking change to the expected format of third-party
|
||||
# In case Rustlings makes an unavoidable breaking change to the expected format of community
|
||||
# exercises, you would need to raise this version and adapt to the new format.
|
||||
# Otherwise, the newest version of the Rustlings program won't be able to run these exercises.
|
||||
format_version = ";
|
||||
@ -97,7 +97,7 @@ format_version = ";
|
||||
const INFO_FILE_AFTER_FORMAT_VERSION: &str = r#"
|
||||
|
||||
# Optional multi-line message to be shown to users when just starting with the exercises.
|
||||
welcome_message = """Welcome to these third-party Rustlings exercises."""
|
||||
welcome_message = """Welcome to these community Rustlings exercises."""
|
||||
|
||||
# Optional multi-line message to be shown to users after finishing all exercises.
|
||||
final_message = """We hope that you found the exercises helpful :D"""
|
||||
@ -141,7 +141,7 @@ publish = false
|
||||
|
||||
const README: &str = "# Rustlings 🦀
|
||||
|
||||
Welcome to these third-party Rustlings exercises 😃
|
||||
Welcome to these community Rustlings exercises 😃
|
||||
|
||||
First, [install Rustlings using the official instructions](https://github.com/rust-lang/rustlings) ✅
|
||||
|
||||
|
@ -79,7 +79,7 @@ impl RunnableExercise for ExerciseInfo {
|
||||
/// The deserialized `info.toml` file.
|
||||
#[derive(Deserialize)]
|
||||
pub struct InfoFile {
|
||||
/// For possible breaking changes in the future for third-party exercises.
|
||||
/// For possible breaking changes in the future for community exercises.
|
||||
pub format_version: u8,
|
||||
/// Shown to users when starting with the exercises.
|
||||
pub welcome_message: Option<String>,
|
||||
@ -91,7 +91,7 @@ pub struct InfoFile {
|
||||
|
||||
impl InfoFile {
|
||||
/// Official exercises: Parse the embedded `info.toml` file.
|
||||
/// Third-party exercises: Parse the `info.toml` file in the current directory.
|
||||
/// Community exercises: Parse the `info.toml` file in the current directory.
|
||||
pub fn parse() -> Result<Self> {
|
||||
// Read a local `info.toml` if it exists.
|
||||
let slf = match fs::read_to_string("info.toml") {
|
||||
|
@ -58,7 +58,7 @@ enum Subcommands {
|
||||
/// The name of the exercise
|
||||
name: Option<String>,
|
||||
},
|
||||
/// Commands for developing (third-party) Rustlings exercises
|
||||
/// Commands for developing (community) Rustlings exercises
|
||||
#[command(subcommand)]
|
||||
Dev(DevCommands),
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ url = "/setup"
|
||||
name = "Usage"
|
||||
url = "/usage"
|
||||
[[extra.menu_items]]
|
||||
name = "Custom Exercises"
|
||||
url = "/custom-exercises"
|
||||
name = "Community Exercises"
|
||||
url = "/community-exercises"
|
||||
[[extra.menu_items]]
|
||||
name = "Q&A"
|
||||
url = "https://github.com/rust-lang/rustlings/discussions/categories/q-a?discussions_q="
|
||||
|
@ -1,24 +1,23 @@
|
||||
+++
|
||||
title = "Custom Exercises"
|
||||
title = "Community Exercises"
|
||||
+++
|
||||
|
||||
Custom exercises are a set of exercises maintained by the community.
|
||||
You can use the same `rustlings` program that you installed with `cargo install rustlings` to run them:
|
||||
|
||||
- 🇯🇵 [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.
|
||||
|
||||
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?
|
||||
|
||||
<!-- toc -->
|
||||
## List of Community Exercises
|
||||
|
||||
The support of Rustlings for custom 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 custom 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 custom exercises, install Rustlings and run `rustlings dev new PROJECT_NAME`.
|
||||
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.
|
@ -52,4 +52,4 @@ If you need any help while doing the exercises and the builtin hints aren't help
|
||||
Once you've completed Rustlings, put your new knowledge to good use!
|
||||
Continue practicing your Rust skills by building your own projects, contributing to Rustlings, or finding other open-source projects to contribute to.
|
||||
|
||||
> If you want to create your own custom Rustlings exercises, visit the [**custom exercises**](@/custom-exercises/index.md) page 🏗️
|
||||
> If you want to create your own Rustlings exercises, visit the [**community exercises**](@/community-exercises/index.md) page 🏗️
|
||||
|
Loading…
x
Reference in New Issue
Block a user