In this video.
I'm going to take a second to explain why I structured the course the way that I did.
Starting off with the basics.
These are the programming building blocks.
And these principles hold true to every programming language where we have variables, functions, control,
flow, etc. because variables are going to be how we store and represent data and then functions are
going to be how we can organize logic in our code and then control flow is going to be how we can account
for situations and execute code based on those situations and potentially other parameters that we check
for.
Following that, we're going to talk about some of the principles that drive rust.
Rust is known for having memory safety.
And to ensure memory safety, there has to be some components that the language is able to validate
in order for us to be assured that we have memory safety.
And these are going to pertain to ownership, borrowing and references.
And then once we're able to kind of understand some of the Russ principles, then we can start getting
into a little bit more complex code examples, such as looking at structs and lifetimes.
Structs are pretty easy to work with, and it's just going to allow us to organize data related to a
common type.
And then lifetimes are really important in rest because it's going to allow the borrow checker to keep
track of how long references are valid for.
And this is going to allow the compiler to make sure that we don't have memory issues such as dangling
references.
E nums and pattern matching e nums are or enumerations are a data type consisting of a set of named
values to help us with abstraction and pattern matching is going to allow us to look and identify if
a value matches a pattern that we have specified and if we have a match, then we execute code based
on what that match was.
But if there's not a match, well then we also know that we have code that we can execute in that situation
as well.
And then we'll follow that up with traits in generics.
So traits are a group of methods that are defined for a particular type, and it's going to be an abstract
definition of shared behavior amongst different types.
And then generics are going to allow our code to be polymorphic meaning.
We do not have to specify the type until compile time.
So for example, we have integers and strings.
Well, we can create code that will be able to.
Operate efficiently on whether our type is an integer or if our type is a string.
And then following that up, we'll look at some common collections.
And these are just data structures that are given to us in the standard library.
And we'll look at what vectors are and we'll look at binary heap, and then we'll also look at maps
and sets and we'll dive into all the associated methods that come with all of these data structures.
And then we'll look at air handling.
And this is going to allow us to write robust code because code can have failures.
So it is important for the programmer to be able to handle failures that may or may not happen, because
if we don't handle them and then we have a failure, well, our program won't know what to do.
And if our program does not know what to do, then we panic.
So, for example, if we have a web server that does not have air handling and we have an error occur,
well then our web server is going to crash.
Therefore, we no longer have a web server that is up and running handling request, which is obviously
really bad.
And then also important is testing.
And testing is important because it will allow us to ensure that our program is operating as we expect
and it might help us find some bugs.
It's also important because as you add code changes, you want to make sure that new code does not break
already existing code.
So it's also a way to verify that as you expand your program or refactor it, that your program continues
to work the way it has in the past.
And then we get into some of the functional programming aspects of Rust, which are integrators and
closures and integrators are essentially how we can count over a range of something.
So from 0 to 10 we can iterate over one, two, three, four, five, six, seven, eight, nine.
And then closures are anonymous functions that we can save in a variable or even pass as arguments to
other functions.
And this is just a simple way to allow us to be expressive in our code.
And then we go to pointers and Rust has smart pointers such as Box, RC and Arc.
And then we also have ref cell.
Now all of these are heap allocated, which is a type of memory and we will be able to we'll talk about
that more as we dive into what pointers are and pointers allow us to directly play with memory.
Pointers are very important because it allows us to store types that don't have a predefined size and
that's why we are able to put them on the heap instead of the stack.
And then we have concurrency and concurrency is going to let our program do more thing at once, essentially.
Right.
But there is concurrency and then there's also parallelism.
And these are kind of different things.
There's a lot of different definitions out there.
But simply concurrency is a task of running or managing multiple computations at the same time, whereas
parallelism is a task of running multiple computations simultaneously.
So an example of parallelism, you throw laundry in the washing machine, but you also have clothes
in the dryer at the same time, right?
So you're washing clothes and also drying clothes at the same time.
And then for concurrency, let's say you have an array and you want to sort the array.
So you give it, you create a sort algorithm, create two threads, and then divvy the work out equally
amongst the two threads.
Right?
So we'll be able to get a better understanding of that when we talk about concurrency and use a library
known as Rayon, and then we're going to talk about macros and unsafe code macros are just a way of
meta programming.
So essentially what that means is we're going to use code to write code and then unsafe code is a feature
in Rust because sometimes you might have to write unsafe code.
And what this means is that the compiler is not going to check it for memory safety.
So you're basically telling the compiler, Hey, I know that my code is safe, so I don't need you to
check it per say.
So it's really important that when you use unsafe code that you double check it to make sure that you
are complying to memory safety.
And then lastly, we're going to talk about asynchronous rust.
And this is a technique in programming to allow the execution to continue in a program, even if there
is a long running task.
And execution will halt once the value from that long running task is needed.
And what I mean by this is, say we kick off a function that's going to take one minute to run.
Well, we don't want our program to wait one minute if we don't need that function until later on in
our execution.
So we'll kick that function off and keep executing our program until the value from that one minute
long function is needed.
And when that value is needed, then our program will stop and wait.
And what this does is it's going to decrease our CPU wait time and it allows us to use our resources
more efficiently, giving us a better runtime.
And if at any point during any of the lectures you have a question.
Udemy provides a Q&A section, so please use it and ask any questions at any point regarding anything
rust related.
I hope you enjoy this journey and I look forward to helping you gain a better understanding of rust.