In this lecture, we are going to explore the starter project generated by cargo.
Let's begin with the route files.
The first file is a get ignore file get is a popular tool for managing projects.
You're very likely familiar with it.
It's a standard tool among developers.
You can write a list of files to prevent them from being committed.
Mighty Falls Cargo recommends not committing a directory called targets.
Our project doesn't have this directory, but it will in the future.
The target directory contains the executable generated by rust.
In a moment, we will look at building the project.
Moving on.
The next file is called Cargo Talkto EML.
It's a configuration file for cargo.
We can compare it to the package JSON file for Node.js projects.
It's possible you may not have syntax highlighting for this type of file out of the box.
Visual Studio Code does not support HTML files.
We can install an extension to enable syntax highlighting switch over to the Extensions tab.
We're going to search for an extension called even better Comal.
Install this extension for VSC.
It's going to provide support for TOEFL files.
In addition, this extension can validate and format our code.
After installing this extension, let's switch back to our configuration file.
The code should be highlighted in your editor.
Perfect.
Let's review the file together.
TOEFL files are very simple at the top of the file.
We have something called a table.
A table is a fancy word for describing different sections of the tile iiml file.
It keeps our configuration organized into groups.
Tables are written with square brackets surrounding the name of the table.
Cargo will define two tables called package and dependencies.
The package table contains settings for describing the project.
Settings are written as key value pairs, so for example, we have the name and version of our project.
You're more than free to modify these values.
However, there are rules you should be aware of when changing these values.
Keep in mind, they'll be read by cargo when its managing or compiling your project.
Luckily, there are descriptions for these settings.
If you hover your mouse over the name key, a description will appear with detailed information, according
to the description.
The name key may only contain alphanumeric characters.
You should always consult with the documentation before modifying these values.
Speaking of documentation, I provide a link to the official documentation page for this file.
This page goes into detail on every setting available.
Feel free to check it out after you finish this course.
First, let's go back to the configuration file.
Out of these settings, the most critical setting is the addition rust is continuously evolving as changes
are made to the language.
There are possible breaking changes for the best backward compatibility.
Rust is broken into additions as of this course.
The latest addition is 2018.
However, its 2021 rust is due for a new addition within the next two months.
If your project contains the 2021 edition, that's perfectly fine.
Our code will be compatible with future editions, so you don't have to revert this option to 2018.
There's another table called Dependencies.
If you would like to install a community package you can list under this table.
By default, this table will be empty.
Dependencies are a topic we will explore in a future lecture that wraps up the cargo akio EML file.
The last thing generated for our project is a directory called Source.
We can write our project code inside this folder.
Cargo creates a file called Main Port R-S.
It's the main entry point of our project.
If we open this file, we'll be given a basic example of a rust file.
Rust files are identified by their extensions, which is R-S.
It's possible you may not have syntax highlighting for rust files.
There's a community extension for rust files.
The name of this extension is called Rust.
Install it for VSC.
After installing it, we can switch back to our file.
The code generated by cargo will output a Hello World message.
We'll talk about the details in a future lecture.
For now, let's try testing the compiler in the terminal.
We can compile rust by running B cargo run command.
Behind the scenes, cargo will use the Rust See tool to compile projects.
Most developers prefer to compile rust through cargo.
The compiler will tell us how long our project took to compile.
It will even run the project after compilation projects will not run unless our program is error free.
If we had an error, the console would output information related to the error.
This default behavior allows us to catch errors before production.
In some cases, you may not care about the status of the builds.
You can ignore these statuses by adding the minus queue option to the cargo run command.
By adding this option, these statuses are ignored from the output.
We only get the output from our program moving along.
You can find the build of your project in a folder called targets.
If this folder doesn't exist, cargo will create it beforehand.
The files in this folder can be deployed to production.
In addition to the target folder, a file called cargo lock is created.
If we open this file, a comment will be written at the top.
It says the following this file is automatically generated by cargo.
It is not intended for manual editing.
As the comment says, We can safely ignore this file cargo completely manages it.
Congrats.
We've successfully created and built our first robust project in the next couple of lectures.
We're going to begin learning the fundamentals of rust.
We'll continue working on our new project.