mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-01-09 20:03:24 +03:00
Compare commits
6 commits
aedeff8b24
...
7f73219041
Author | SHA1 | Date | |
---|---|---|---|
7f73219041 | |||
196d3c1a98 | |||
8c60ac267e | |||
3c7e7368b2 | |||
593f0e0916 | |||
1508938fed |
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -303,9 +303,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.3"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"allocator-api2",
|
||||
|
@ -649,7 +649,7 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
|||
|
||||
[[package]]
|
||||
name = "rustlings"
|
||||
version = "6.0.0-beta.5"
|
||||
version = "6.0.0-beta.6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"assert_cmd",
|
||||
|
@ -668,7 +668,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustlings-macros"
|
||||
version = "6.0.0-beta.5"
|
||||
version = "6.0.0-beta.6"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"serde",
|
||||
|
|
|
@ -8,7 +8,7 @@ exclude = [
|
|||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "6.0.0-beta.5"
|
||||
version = "6.0.0-beta.6"
|
||||
authors = [
|
||||
"Liv <mokou@fastmail.com>",
|
||||
"Mo Bitar <mo8it@proton.me>",
|
||||
|
@ -50,11 +50,11 @@ include = [
|
|||
anyhow = "1.0.82"
|
||||
clap = { version = "4.5.4", features = ["derive"] }
|
||||
crossterm = "0.27.0"
|
||||
hashbrown = "0.14.3"
|
||||
hashbrown = "0.14.5"
|
||||
notify-debouncer-mini = { version = "0.4.1", default-features = false }
|
||||
os_pipe = "1.1.5"
|
||||
ratatui = { version = "0.26.2", default-features = false, features = ["crossterm"] }
|
||||
rustlings-macros = { path = "rustlings-macros", version = "=6.0.0-beta.5" }
|
||||
rustlings-macros = { path = "rustlings-macros", version = "=6.0.0-beta.6" }
|
||||
serde_json = "1.0.116"
|
||||
serde.workspace = true
|
||||
toml_edit.workspace = true
|
||||
|
|
19
README.md
19
README.md
|
@ -35,7 +35,7 @@ The following command will download and compile Rustlings:
|
|||
<!-- TODO: Remove @6.0.0-beta.x -->
|
||||
|
||||
```bash
|
||||
cargo install rustlings@6.0.0-beta.5
|
||||
cargo install rustlings@6.0.0-beta.6
|
||||
```
|
||||
|
||||
<details>
|
||||
|
@ -44,7 +44,7 @@ cargo install rustlings@6.0.0-beta.5
|
|||
<!-- TODO: Remove @6.0.0-beta.x -->
|
||||
|
||||
- Make sure you have the latest Rust version by running `rustup update`
|
||||
- Try adding the `--locked` flag: `cargo install rustlings@6.0.0-beta.5 --locked`
|
||||
- Try adding the `--locked` flag: `cargo install rustlings@6.0.0-beta.6 --locked`
|
||||
- Otherwise, please [report the issue](https://github.com/rust-lang/rustlings/issues/new)
|
||||
|
||||
</details>
|
||||
|
@ -64,6 +64,21 @@ cd rustlings/
|
|||
rustlings
|
||||
```
|
||||
|
||||
## Working environment
|
||||
|
||||
### Editor
|
||||
|
||||
Our general recommendation is [VS Code](https://code.visualstudio.com/) with the [rust-analyzer plugin](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).
|
||||
But any editor that supports [rust-analyzer](https://rust-analyzer.github.io/) should be enough for working on the exercises.
|
||||
|
||||
### Terminal
|
||||
|
||||
While working with Rustlings, please use a modern terminal for the best user experience.
|
||||
The default terminal on Linux and Mac should be sufficient.
|
||||
On Windows, we recommend the [Windows Terminal](https://aka.ms/terminal).
|
||||
|
||||
If you use VS Code, the builtin terminal should also be fine.
|
||||
|
||||
## Doing exercises
|
||||
|
||||
The exercises are sorted by topic and can be found in the subdirectory `exercises/<topic>`.
|
||||
|
|
|
@ -69,6 +69,7 @@ pub fn init() -> Result<()> {
|
|||
}
|
||||
|
||||
const GITIGNORE: &[u8] = b".rustlings-state.txt
|
||||
solutions
|
||||
Cargo.lock
|
||||
target
|
||||
.vscode
|
||||
|
|
|
@ -42,7 +42,7 @@ pub fn list(app_state: &mut AppState) -> Result<()> {
|
|||
ui_state.message.clear();
|
||||
|
||||
match key.code {
|
||||
KeyCode::Esc | KeyCode::Char('q') => break,
|
||||
KeyCode::Char('q') => break,
|
||||
KeyCode::Down | KeyCode::Char('j') => ui_state.select_next(),
|
||||
KeyCode::Up | KeyCode::Char('k') => ui_state.select_previous(),
|
||||
KeyCode::Home | KeyCode::Char('g') => ui_state.select_first(),
|
||||
|
|
|
@ -2,7 +2,7 @@ use anyhow::{Context, Result};
|
|||
use ratatui::{
|
||||
layout::{Constraint, Rect},
|
||||
style::{Style, Stylize},
|
||||
text::Span,
|
||||
text::{Line, Span},
|
||||
widgets::{Block, Borders, HighlightSpacing, Paragraph, Row, Table, TableState},
|
||||
Frame,
|
||||
};
|
||||
|
@ -193,11 +193,25 @@ impl<'a> UiState<'a> {
|
|||
|
||||
let message = if self.message.is_empty() {
|
||||
// Help footer.
|
||||
Span::raw(
|
||||
"↓/j ↑/k home/g end/G │ <c>ontinue at │ <r>eset │ filter <d>one/<p>ending │ <q>uit",
|
||||
)
|
||||
let mut spans = Vec::with_capacity(4);
|
||||
spans.push(Span::raw(
|
||||
"↓/j ↑/k home/g end/G │ <c>ontinue at │ <r>eset │ filter ",
|
||||
));
|
||||
match self.filter {
|
||||
Filter::Done => {
|
||||
spans.push("<d>one".underlined().magenta());
|
||||
spans.push(Span::raw("/<p>ending"));
|
||||
}
|
||||
Filter::Pending => {
|
||||
spans.push(Span::raw("<d>one/"));
|
||||
spans.push("<p>ending".underlined().magenta());
|
||||
}
|
||||
Filter::None => spans.push(Span::raw("<d>one/<p>ending")),
|
||||
}
|
||||
spans.push(Span::raw(" │ <q>uit"));
|
||||
Line::from(spans)
|
||||
} else {
|
||||
self.message.as_str().light_blue()
|
||||
Line::from(self.message.as_str().light_blue())
|
||||
};
|
||||
frame.render_widget(
|
||||
message,
|
||||
|
|
Loading…
Reference in a new issue