Chapter 2. A Tour of Rust
Toute l’expérience d’un individu est construit sur le plan de son langage. (An individual’s experience is built entirely in terms of his language.)
In this chapter we’ll look at several short programs to see how Rust’s syntax, types, and semantics fit together to support safe, concurrent, and efficient code. We’ll walk through the process of downloading and installing Rust, show some simple mathematical code, try out a web server based on a third-party library, and use multiple threads to speed up the process of plotting the Mandelbrot set.
Downloading and Installing Rust
The best way to install Rust is to use
rustup, the Rust installer. Go to https://rustup.rs and follow the instructions there.
You can, alternatively, go to https://www.rust-lang.org, click Downloads, and get pre-built packages for Linux, macOS, and Windows. Rust is also included in some operating system distributions. We prefer
rustup because it’s a tool for managing Rust installations, like RVM for Ruby or NVM for Node. For example, when a new version of Rust is released, you’ll be able to upgrade with zero clicks by typing
In any case, once you’ve completed the installation, you should have three new commands available at your command line:
cargo 0.18.0 (fe7b0cdcf 2017-04-24)
rustc 1.17.0 (56124baa9 2017-04-24)
rustdoc 1.17.0 (56124baa9 2017-04-24)
$ is the command prompt; on Windows, ...