Now that we've seen a preview of the
project that we will build for this
course, let's get started by laying out
the skeleton of the project. The first
thing that you need to do for any new
project is to select a name, this project
is patterned after the popular PV
utility, which stands for pipe viewer. So
I'm going to use the project name pipe
viewer, you may use a different project
name if you wish. All that you need to do
is to substitute the name of your choice
wherever I use pipe viewer. Next, we need
to choose a location for our project on
disk. I like to keep my projects in a
dedicated folder, so I will create pipe
viewer in my projects directory. The
location doesn't really matter just as
long as you remember where you put it.
First, I need to get into my projects
directory,
now we can create the project.
Our project is a binary project which is
the default project type, so we don't
have to add any options now let's get
into the directory,
and double-check our Cargo settings.
Cargo.toml is in the top level of the
project. In our package section, we can
see that our name is pipe viewer our
version is 0.10, I am the author, has my
name in my email address, and the
addition is 2018. Our project settings
look good. In a real project, we would
probably use version control software,
such as Git or subversion. Let me show
you a few things that you should
configure your version control software
to ignore in real projects. I will go
ahead and initialize this as a Git
repository,
and then I will create a dot Git ignore
file to tell Git which files it should
never try to track.
The target subdirectory contains all of
your builds files and binaries, things
that aren't source code that you will
generate.
In any directory, which is what the first
two asterisks means, there could be a
file or some files ending in dot RS BK.
Those are backup files that Cargo format
uses when you are Auto formatting your
code and might get left behind,
those are good to ignore, and not
accidentally add to your version control.
Now if we were making a library I would
also add Cargo dot lock, but we are not
making a library so I will comment that
back out. In the next section, we will
have a look at operating with I/O.