In this lecture, we are going to install rust on our machines before we do, let's talk about rust.
As I mentioned before, it's one of the most loved languages by developers.
Why is that?
What makes it so unique?
Designing a programming language is a tough job.
Communities will not hesitate to point out the pain points of a language.
Rust was designed to solve the problems present in other languages, while not unique.
Rust is a statically typed language.
These types of languages allow the compiler to run checks on our data and functions.
Thus, we can catch errors during compilation.
This feature does force developers to write more code.
One of the most significant drawbacks of a statically typed language is readability.
Rust introduces type inference to help with readability, which we'll talk about in a future lecture.
Out of all the languages available, rust is highly memory efficient.
If you are a JavaScript developer, memory may not be something you think about frequently.
Whenever you define a variable, you're taking up memory on a user's machine.
One variable is not going to kill a user's browser, but hundreds of them can.
Rust emphasizes memory safety.
A majority of popular languages employ a garbage collector.
It's a program that continuously checks your application for unused memory.
Garbage collectors can automate the action of freeing memory.
The problem with garbage collectors is that they're slow and unpredictable.
We don't have control when they run, when they do run.
They require additional resources to handle freeing memory.
Unlike other languages, Rust guarantees memory safety.
It's completely aware of when memory should be free.
Periodic checks are not performed.
Instead, it knows exactly when memory can be released.
Lastly, rust is highly performance.
It's just as fast as C or Java, since it's a memory efficient language.
You never have to pay for things you aren't using.
If this sounds foreign to you, that's completely fine.
Throughout this course, we'll get firsthand experience with these features.
Let's move on to installing rust.
If you're on a Mac or Linux, rust can be installed through the terminal.
You should run these commands to begin the installation.
After installation, a success message should appear.
Rust is a relatively easy language to install.
If you're on a Windows machine, the installation is slightly different in the resource section of this
lecture, I provide a link to the installation page of Rust.
Windows users can run a downloadable installer.
There's a 32 and 64 bit version.
In most cases, the 64 bit version should work for most users.
Download the installer and run the installation.
It's a standard installation process.
Just click next until the program is installed.
I'm going to quickly install rust on my machine.
After installation, three tools are going to be installed on your system.
They are accessible via the command line.
The first tool is called Rust Up.
It's a tool for managing different versions of rust.
Other projects may require different versions of rust.
Ideally, you want projects to run on the latest version.
In some cases, you may need experimental or beta features through the rust up command.
You can install a nightly version of Rust.
The second tool is called Rust.
C Rust needs to be compiled from human readable code to binary code.
The Rust See Command will perform this process for you.
Normally, you won't need to run this command because of the cargo tool.
This command is responsible for managing dependencies for your project.
It can also compile your projects behind the scenes.
It runs the Rust See command.
Therefore, you can skip running the Rust See commands.
Let's explore these tools.
We're going to skip the Rust See tool since the cargo command runs this tool for us.
First, let's explore the Rust Up tool.
Currently, I'm in an empty directory with the command line opened.
If you're using Visual Studio code, you can open a new terminal by navigating to Terminal New Terminal.
The rust up tool is not hard to use.
It's very likely you'll be using it to upgrade rust.
We can upgrade rust by typing the Rust Up Update Command.
We've installed the latest version of Rust.
It shouldn't take long for Rust to realize it doesn't have to update our project.
In most cases, you will use the rust up command to upgrade your rust version, which I always recommend
doing.
New releases are frequent from the Rust team.
In the resource section of this lecture, I provide a link to a book called Rust Up.
One of the things I love about the Rus community is their effort to share basic knowledge with beginners.
This book provides a basic overview of the Rust Up tool.
It's completely free and aimed at newcomers.
If you would like more information about this tool, I highly recommend reading this book.
Let's move on to the cargo tool.
Cargo is analogous to 21:00.
Cargo is to rust, as 21:00 is to JavaScript.
Simple, right?
In the resource section of this lecture, I provide a link to a registry called Crates.
You can find community contributed packages on this site.
It's very popular with the Rust community.
Almost nine billion downloads have been made.
The crates tool has various commands for creating a project.
Let's give it a try.
Switch back to the command line.
We can create a new project by typing the cargo in it commands.
After a few seconds, the command should have generated a new project in the following lecture.
We're going to begin exploring the project generated by Chicago.