1. 1
    Setup Rustlings
    1m 44s

Setup Rustlings

Chris Biscardi
InstructorChris Biscardi
Share this video with your friends

Social Share Links

Send Tweet

Set up for Rust exercises.

Chris Biscardi: [0:00] If you're just getting started with Rust, and you want to learn a little bit more, get your hands on some code, not get too deep, don't do any huge projects or anything like that. There's this free book called "Rustlings" that will let you take a bunch of small exercises that have a bunch of tests written for them, and get you used to reading and writing Rust code.

[0:18] Now, I'm on MacOS. I'm going to copy and paste the cURL command which will download a script, and pipe it to bash which runs it. After we run the script, if you see this message at the end, that means everything worked, and you don't have to do anything else.

[0:31] Note that this script checks for Git, Rust, Cargo, and some other things. I already have all these tools installed, so I don't need to do anything else. We can cd into the rustlings directory. Inside of this directory, you'll see an installed.sh and a number of other things. Really, the only directory we care about is exercises. This includes all the exercises that we'll end up doing.

[0:52] The cURL command we ran before installed a CLI tool for us. The CLI tool is called rustlings. If we run rustlings watch, we can see an error. This error is in the exercises/variables/variables1.rs file.

[1:09] As we work through these exercises, you'll note that we'll first see an error in a particular file. We'll fix the error, and then it'll move on to the next file. In this way we can use rustlings watch to go through the entire rustlings repo.

[1:23] Note that you can also use the rustlings run to run specific exercises, get hints, or verify them. Finally, note that the version of rustlings that we are going to use includes a couple of exercises that aren't necessarily included in watch, or aren't necessarily ready for people to do, or aren't documented enough. Those are listed here. Let's get started.