Using a Rust tutorial
There exists an interactive tutorial at https://rust-book.cs.brown.edu/. While reading this tutorial, you will be able to take quizzes and to let annotations that can be re-read later on.
You will not have to read the full tutorial at this time. We suggest that you ensure that you understand the concepts (and pass the quizzes) in the following chapters:
- 3.1 Variables and Mutability
- 3.3 Functions
- 4.1 What is Ownership?
- 4.2 References and Borrowing
- 4.3 The Slice Type
Of course, you are invited to read more chapters and take more quizzes as the lecturers describe new Rust concepts.
If you want to do more
Another way to familiarize yourself with Rust programming is to use the rustlings repository and program. Start by installing the rustings
program and clone the rustlings
repository containing the exercises:
$ cargo install rustlings
$ git clone https://github.com/rust-lang/rustlings/
$ cd rustlings
$ rustlings watch
The source for this exercise is in `exercises/intro/intro1.rs`. Have a look!
Going forward, the source of the exercises will always be in the success/failure output.
====================
You can keep working on this exercise,
or jump into the next one by removing the `I AM NOT DONE` comment
[…waits forever…]
The latest command rustlings watch
will watch your progress while editing the exercises in the exercises
directory of the repository.
For example, following the instructions given by rustlings watch
, edit the file exercises/intro/intro1.rs
with your favourite editor. As an exception, this exercise already compiles succesfully. All you have to do is remove the line // I AM NOT DONE
so that rustlings watch
will go to the next exercise in the series, exercises/intro/intro2.rs
.
This one will not compile. You have to edit the code so that it compiles successfully, then when you see that it does you can remove the // I AM NOT DONE
line, and so on.
You can stop doing the exercises whenever you want (just stop the rustlings watch
program). When you run rustlings watch
again it will start from where you left off.