First Look at the Rust Language

Last year, while browsing job sites, I happened to come across the Rust programming language and made a mental note of it. It just so happens that I’m not too busy these days, so let me start by getting a first look at it.

The official website describes it like this:
A language empowering everyone to build reliable and efficient software.

First, set up the local environment

Mine is a linux system, so I’ll run the following command

1
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh

Once it’s installed, type this in the command window

1
rustc -V

and you’ll see

which means the installation succeeded

Installing it also installs cargo

Cargo is Rust’s build system and package manager. Most Rustaceans use Cargo to manage their Rust projects, because it can handle a lot of tasks for you, such as building code, downloading dependency libraries and compiling those libraries

If typing rust -V or cargo —version anywhere in the terminal gives no response, then you need to symlink these two installed commands into /usr/local/bin or /usr/bin so that they can be used globally.

At this point the Rust environment is configured.

Next, let’s develop a guessing game following the documentation; the code is as follows

The final result