In this lecture, we were going to start working on the mini project, I have planned for this course
before digging into the code.
Let's find out what will build.
We are going to develop an image processing app for the sake of simplicity.
The app will apply a grayscale effect to an image.
Users will be able to upload their colored images to convert to a black and white image.
It's a simple project, but it'll give us insight into building web assembly projects by the end of
this project.
You will know how to expand it to include other effects.
For example, it should be pretty easy to resize images, add a blurry fact, or crop an area of an
image.
In fact, I encourage you to explore other effects after finishing this course.
Let's get started.
The first step is to generate a new project.
Unlike before, we're not going to generate a binary project.
Generally speaking, projects can fall into one of two categories.
We have binary and library projects.
Up until now, we've been creating binary projects a binary project compiles to an executable program.
Users can run this program on their machines by default.
Cargo generates binary projects On the other end of the spectrum, there are library projects.
These projects compile into dependencies for other projects.
If you think about it, that's what we need for our current project.
We're not going to ask users to run an executable file on their machines for safety reasons.
Browsers don't allow users to run executables in the browser.
We are going to be using HTML and JavaScript for handling the UI in their browser.
Russ will handle processing files.
We can think of Roest as a dependency for our project.
Therefore, it makes sense to create a library project instead of a binary project.
Creating a library project can be done through the cargo net command inside the command line and the
following command cargo in its lib.
The Library option will generate a library project.
We can run the command to initialize the project after a couple of moments, a new project should have
been created.
It's not going to be much different than a library project.
Let's quickly explore the files.
The first file is the Cargo Actio Mail file.
Nothing will change in this file.
Cargo produces two tables, which are called package and dependencies.
We're already familiar with these tables.
We won't review them again.
Back in the file tree, there's a folder called source with a file called Library Express.
Unlike before, Russell does not define a main function.
Library projects do not need to define this function.
Previously, if this function was not defined, the compiler would throw an error.
It's not necessary for a library project by default.
Cargo has generated a test for our library.
Testing rust objects is a topic we won't be covering in this course.
It's safe to empty out the file in the next lecture.
We are going to begin adding web pack to process rust files.