mirror of
https://github.com/rust-lang/rustlings
synced 2024-11-03 03:40:13 +00:00
docs: Move content from Readme to Contributing
This commit is contained in:
parent
635e506c16
commit
2089901739
@ -6,6 +6,8 @@ First off, thanks for taking the time to contribute!! ❤️
|
||||
|
||||
I want to...
|
||||
|
||||
_add an exercise! ➡️ [read this](#addex) and then [open a Pull Request](#prs)_
|
||||
|
||||
_update an outdated exercise! ➡️ [open a Pull Request](#prs)_
|
||||
|
||||
_report a bug! ➡️ [open an Issue](#issues)_
|
||||
@ -14,6 +16,34 @@ _fix a bug! ➡️ [open a Pull Request](#prs)_
|
||||
|
||||
_implement a new feature! ➡️ [open an Issue to discuss it first, then a Pull Request](#issues)_
|
||||
|
||||
<a name="#src"></a>
|
||||
### Working on the source code
|
||||
|
||||
`rustlings` is basically a glorified `rustc` wrapper. Therefore the source code
|
||||
isn't really that complicated since the bulk of the work is done by `rustc`.
|
||||
`src/main.rs` contains a simple `clap` CLI that loads from `src/verify.rs` and `src/run.rs`.
|
||||
|
||||
<a name="addex"></a>
|
||||
### Adding an exercise
|
||||
|
||||
First step is to add the exercise! Call it `exercises/yourTopic/yourTopicN.rs`, make sure to
|
||||
put in some helpful links, and link to sections of the book in `exercises/yourTopic/README.md`.
|
||||
|
||||
Next you want to make sure it runs when using `rustlings`. All exercises are stored in `info.toml`, under the `exercises` array. They're ordered by the order they're ran when using `rustlings verify`.
|
||||
|
||||
You want to make sure where in the file you add your exercise. If you're not sure, add it at the bottom and ask in your pull request. To add an exercise, edit the file like this:
|
||||
```diff
|
||||
...
|
||||
+ [[exercises]]
|
||||
+ path = "exercises/yourTopic/yourTopicN.rs"
|
||||
+ mode = "compile"
|
||||
...
|
||||
```
|
||||
|
||||
The `mode` attribute decides whether Rustlings will only compile your exercise, or compile and test it. If you have tests to verify in your exercise, choose `test`, otherwise `compile`.
|
||||
|
||||
That's all! Feel free to put up a pull request.
|
||||
|
||||
<a name="issues"></a>
|
||||
### Issues
|
||||
|
||||
|
26
README.md
26
README.md
@ -94,31 +94,7 @@ If you are interested in improving or adding new ones, please feel free to contr
|
||||
|
||||
## Contributing
|
||||
|
||||
### Adding an exercise
|
||||
|
||||
First step is to add the exercise! Call it `exercises/yourTopic/yourTopicN.rs`, make sure to
|
||||
put in some helpful links, and link to sections of the book in `exercises/yourTopic/README.md`.
|
||||
|
||||
Next you want to make sure it runs when using `rustlings`. All exercises are stored in `info.toml`, under the `exercises` array. They're ordered by the order they're ran when using `rustlings verify`.
|
||||
|
||||
You want to make sure where in the file you add your exercise. If you're not sure, add it at the bottom and ask in your pull request. To add an exercise, edit the file like this:
|
||||
```diff
|
||||
...
|
||||
+ [[exercises]]
|
||||
+ path = "exercises/yourTopic/yourTopicN.rs"
|
||||
+ mode = "compile"
|
||||
...
|
||||
```
|
||||
|
||||
The `mode` attribute decides whether Rustlings will only compile your exercise, or compile and test it. If you have tests to verify in your exercise, choose `test`, otherwise `compile`.
|
||||
|
||||
That's all! Feel free to put up a pull request.
|
||||
|
||||
### Working on the source code
|
||||
|
||||
`rustlings` is basically a glorified `rustc` wrapper. Therefore the source code
|
||||
isn't really that complicated since the bulk of the work is done by `rustc`.
|
||||
`src/main.rs` contains a simple `clap` CLI that loads from `src/verify.rs` and `src/run.rs`.
|
||||
See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
||||
|
||||
## Credits
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user