Skip to content

Commit 19cee73

Browse files
author
liv
committed
chore: set up oranda
Sets up oranda so we can get nice website things for free. Some caveats we have right now: - Absolutely manual, I have to do `oranda build` and the deploy manually right now - I had to pop the Readme into a new Markdown file because the first header in there was looking very strange
1 parent 4c638e3 commit 19cee73

File tree

4 files changed

+192
-0
lines changed

4 files changed

+192
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ rust-project.json
1111
!.vscode/extensions.json
1212
*.iml
1313
*.o
14+
public/
15+
16+
# Local Netlify folder
17+
.netlify

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
22
name = "rustlings"
3+
description = "Small exercises to get you used to reading and writing Rust code!"
34
version = "5.5.0"
45
authors = [
56
"Liv <mokou@fastmail.com>",

oranda.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"homepage": "https://rustlings.cool",
3+
"readme_path": "website.md",
4+
"repository": "https://github.com/rust-lang/rustlings",
5+
"analytics": {
6+
"plausible": {
7+
"domain": "rustlings.cool"
8+
}
9+
},
10+
"changelog": true
11+
}

website.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
Greetings and welcome to `rustlings`. This project contains small exercises to get you used to reading and writing Rust code. This includes reading and responding to compiler messages!
2+
3+
Alternatively, for a first-time Rust learner, there are several other resources:
4+
5+
- [The Book](https://doc.rust-lang.org/book/index.html) - The most comprehensive resource for learning Rust, but a bit theoretical sometimes. You will be using this along with Rustlings!
6+
- [Rust By Example](https://doc.rust-lang.org/rust-by-example/index.html) - Learn Rust by solving little exercises! It's almost like `rustlings`, but online
7+
8+
## Getting Started
9+
10+
_Note: If you're on MacOS, make sure you've installed Xcode and its developer tools by typing `xcode-select --install`._
11+
_Note: If you're on Linux, make sure you've installed gcc. Deb: `sudo apt install gcc`. Yum: `sudo yum -y install gcc`._
12+
13+
You will need to have Rust installed. You can get it by visiting https://rustup.rs. This'll also install Cargo, Rust's package/project manager.
14+
15+
## MacOS/Linux
16+
17+
Just run:
18+
19+
```bash
20+
curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash
21+
```
22+
23+
Or if you want it to be installed to a different path:
24+
25+
```bash
26+
curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash -s mypath/
27+
```
28+
29+
This will install Rustlings and give you access to the `rustlings` command. Run it to get started!
30+
31+
### Nix
32+
33+
Basically: Clone the repository at the latest tag, finally run `nix develop` or `nix-shell`.
34+
35+
```bash
36+
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.5.0)
37+
git clone -b 5.5.0 --depth 1 https://github.com/rust-lang/rustlings
38+
cd rustlings
39+
# if nix version > 2.3
40+
nix develop
41+
# if nix version <= 2.3
42+
nix-shell
43+
```
44+
45+
## Windows
46+
47+
In PowerShell (Run as Administrator), set `ExecutionPolicy` to `RemoteSigned`:
48+
49+
```ps1
50+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
51+
```
52+
53+
Then, you can run:
54+
55+
```ps1
56+
Start-BitsTransfer -Source https://raw.githubusercontent.com/rust-lang/rustlings/main/install.ps1 -Destination $env:TMP/install_rustlings.ps1; Unblock-File $env:TMP/install_rustlings.ps1; Invoke-Expression $env:TMP/install_rustlings.ps1
57+
```
58+
59+
To install Rustlings. Same as on MacOS/Linux, you will have access to the `rustlings` command after it. Keep in mind that this works best in PowerShell, and any other terminals may give you errors.
60+
61+
If you get a permission denied message, you might have to exclude the directory where you cloned Rustlings in your antivirus.
62+
63+
## Browser
64+
65+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/rust-lang/rustlings)
66+
67+
[![Open Rustlings On Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new/?repo=rust-lang%2Frustlings&ref=main)
68+
69+
## Manually
70+
71+
Basically: Clone the repository at the latest tag, run `cargo install --path .`.
72+
73+
```bash
74+
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.5.0)
75+
git clone -b 5.5.0 --depth 1 https://github.com/rust-lang/rustlings
76+
cd rustlings
77+
cargo install --force --path .
78+
```
79+
80+
If there are installation errors, ensure that your toolchain is up to date. For the latest, run:
81+
82+
```bash
83+
rustup update
84+
```
85+
86+
Then, same as above, run `rustlings` to get started.
87+
88+
## Doing exercises
89+
90+
The exercises are sorted by topic and can be found in the subdirectory `rustlings/exercises/<topic>`. For every topic there is an additional README file with some resources to get you started on the topic. We really recommend that you have a look at them before you start.
91+
92+
The task is simple. Most exercises contain an error that keeps them from compiling, and it's up to you to fix it! Some exercises are also run as tests, but rustlings handles them all the same. To run the exercises in the recommended order, execute:
93+
94+
```bash
95+
rustlings watch
96+
```
97+
98+
This will try to verify the completion of every exercise in a predetermined order (what we think is best for newcomers). It will also rerun automatically every time you change a file in the `exercises/` directory. If you want to only run it once, you can use:
99+
100+
```bash
101+
rustlings verify
102+
```
103+
104+
This will do the same as watch, but it'll quit after running.
105+
106+
In case you want to go by your own order, or want to only verify a single exercise, you can run:
107+
108+
```bash
109+
rustlings run myExercise1
110+
```
111+
112+
Or simply use the following command to run the next unsolved exercise in the course:
113+
114+
```bash
115+
rustlings run next
116+
```
117+
118+
In case you get stuck, you can run the following command to get a hint for your
119+
exercise:
120+
121+
```bash
122+
rustlings hint myExercise1
123+
```
124+
125+
You can also get the hint for the next unsolved exercise with the following command:
126+
127+
```bash
128+
rustlings hint next
129+
```
130+
131+
To check your progress, you can run the following command:
132+
133+
```bash
134+
rustlings list
135+
```
136+
137+
## Testing yourself
138+
139+
After every couple of sections, there will be a quiz that'll test your knowledge on a bunch of sections at once. These quizzes are found in `exercises/quizN.rs`.
140+
141+
## Enabling `rust-analyzer`
142+
143+
Run the command `rustlings lsp` which will generate a `rust-project.json` at the root of the project, this allows [rust-analyzer](https://rust-analyzer.github.io/) to parse each exercise.
144+
145+
## Continuing On
146+
147+
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.
148+
149+
## Uninstalling Rustlings
150+
151+
If you want to remove Rustlings from your system, there are two steps. First, you'll need to remove the exercises folder that the install script created
152+
for you:
153+
154+
```bash
155+
rm -rf rustlings # or your custom folder name, if you chose and or renamed it
156+
```
157+
158+
Second, run `cargo uninstall` to remove the `rustlings` binary:
159+
160+
```bash
161+
cargo uninstall rustlings
162+
```
163+
164+
Now you should be done!
165+
166+
## Contributing
167+
168+
See [CONTRIBUTING.md](./CONTRIBUTING.md).
169+
170+
Development-focused discussion about Rustlings happens in the [**rustlings** stream](https://rust-lang.zulipchat.com/#narrow/stream/334454-rustlings)
171+
on the [Rust Project Zulip](https://rust-lang.zulipchat.com). Feel free to start a new thread there
172+
if you have ideas or suggestions!
173+
174+
## Contributors ✨
175+
176+
Thanks goes to the wonderful people listed in [AUTHORS.md](./AUTHORS.md) 🎉

0 commit comments

Comments
 (0)