Rust Playground

See this chapter on YouTube

Maybe you don't want to install Rust yet, and that's okay. You can go to https://play.rust-lang.org/ and start writing Rust without leaving your browser. You can write your code there and click Run to see the results. You can run most of the samples in this book inside the Playground in your browser. Only near the end you will see samples that go beyond what you can do in the Playground (like opening files).

Here are some tips when using the Rust Playground:

  • Run your code with Run
  • Change Debug to Release if you want your code to be faster. Debug: compiles faster, runs slower, contains debug information. Release: compiles slower, runs much faster, removes debug information.
  • Click on Share to get a url link. You can use that to share your code if you want help. After you click share, you can click on Open a new thread in the Rust user forum to ask people there for help right away.
  • Tools: Rustfmt will format your code nicely.
  • Tools: Clippy will give you extra information about how to make your code better.
  • Config: here you can change your theme to dark mode so you can work at night, and many other configurations.

If you want to install Rust, go here https://www.rust-lang.org/tools/install and follow the instructions. Usually you will use rustup to install and update Rust.