Rust is a memory-safe compiled programming language for building high-performance systems. It has the simplicity of high-level languages (Go, Python), but the control of low-level languages (C, Cpp) https://github.com/fireship-io/rust-in-100

#programming #rust #100SecondsOfCode

🔗 Resources

Rust Docs https://www.rust-lang.org/learn
Rust Book https://doc.rust-lang.org/book/
Rust Quickstart https://github.com/fireship-io/rust-in-100

Also see Go in 100 Seconds https://youtu.be/446E-r0rXHI

🔥 Get More Content - Upgrade to PRO

Upgrade to Fireship PRO at https://fireship.io/pro
Use code lORhwXd2 for 25% off your first payment. 

🎨 My Editor Settings

- Atom One Dark 
- vscode-icons
- Fira Code Font

🔖 Topics Covered

- Rust ownership and borrowing explained
- How Rust memory management works
- Get started with Rust
- Rust vs Go
- Rust vs C
2024-02-04T05:43:22.646Z
nova-2
2-general-nova
2024-01-09.29447
30089e05-99d1-4376-b32e-c263170674af
d8e25bf4-f2fa-4ea6-8fa2-3528fb99cb69
5398d941dff5fe990ac3930a302d2ed056081e3ef5b69b0f048c18c7cd7267aa
67875a7f-c9c4-48a0-aa55-5bdb8a91c34a
deprecated
Rust, a memory safe compiled programming language that delivers high level simplicity with low level performance.
It's a popular choice for building systems where performance is absolutely critical, like game engines, databases, or operating systems, and is an excellent choice when targeting web assembly.
It started as a side project upgrade on horror in 2007, who named it after the rust fungus.
It was sponsored by Mozilla in 2009 and has been ranked most loved programming language every year since 2016, with its fans being known as restations.
Traditionally, high level languages provide a garbage collector to nerf your control over memory management, while lower level languages provide functions like free and allocate to shoot yourself in the foot.
Rust takes a different approach.
It has no garbage collector, but achieves memory safety with a concept known as ownership and borrowing.
By default, every variable in Rust is immutable.
This allows values to be used in the stack memory, which has minimal performance overhead.
However, mutable values or objects with an unknown size at compile time are stored in the heap memory.
Every value in a Rust program is assigned to a single variable known as its owner.
When that variable goes out of scope, the memory allocated to it is dropped automatically.
In some cases though, you may want to pass a reference to a different part of the program.
Borrowing allows you to access a reference in memory without taking ownership of it.
There are a ton of rules to go along with the system that the Rust borrow checker will validate at compile time.
These rules keep your code safe while providing absolute control over performance.
Rust also has a package manager called cargo, where each individual package is a crate.
To get started, install Rust, then run cargo new from the command line.
Sim.
In the main dot RS file, you'll find a main function, which is where the program will start executing.
Declare a variable with let, followed by its name and type.
The value can't be changed or reassigned by default, so add mutt to make it mutable.
The name of the variable is the owner.
A reference to its location in memory can be borrowed by other parts of the program by prefixing it with an ampersand, then use a macro like print line to log the value to the standard output.
Rust also comes with a standard library that contains modules to handle IO, the file system, concurrency, among many other things.
Now, compile your code to an executable with the Rust compiler.
You just built a memory safe executable that can handle the most performance intensive system requirements.
This has been Rust in 100 seconds.
Hit the like button and subscribe if you wanna see more short videos like this, and leave a comment if you wanna see a full Rust tutorial.
Thanks for watching, and I will see you in the next one.

Speaker 0: Rust, a memory safe compiled programming language that delivers high level simplicity with low level performance. It's a popular choice for building systems where performance is absolutely critical, like game engines, databases, or operating systems, and is an excellent choice when targeting web assembly. It started as a side project upgrade on horror in 2007, who named it after the rust fungus. It was sponsored by Mozilla in 2009 and has been ranked most loved programming language every year since 2016, with its fans being known as restations. Traditionally, high level languages provide a garbage collector to nerf your control over memory management, while lower level languages provide functions like free and allocate to shoot yourself in the foot.

Rust takes a different approach. It has no garbage collector, but achieves memory safety with a concept known as ownership and borrowing. By default, every variable in Rust is immutable. This allows values to be used in the stack memory, which has minimal performance overhead. However, mutable values or objects with an unknown size at compile time are stored in the heap memory.

Every value in a Rust program is assigned to a single variable known as its owner. When that variable goes out of scope, the memory allocated to it is dropped automatically. In some cases though, you may want to pass a reference to a different part of the program. Borrowing allows you to access a reference in memory without taking ownership of it. There are a ton of rules to go along with the system that the Rust borrow checker will validate at compile time.

These rules keep your code safe while providing absolute control over performance. Rust also has a package manager called cargo, where each individual package is a crate. To get started, install Rust, then run cargo new from the command line. Sim. In the main dot RS file, you'll find a main function, which is where the program will start executing.

Declare a variable with let, followed by its name and type. The value can't be changed or reassigned by default, so add mutt to make it mutable. The name of the variable is the owner. A reference to its location in memory can be borrowed by other parts of the program by prefixing it with an ampersand, then use a macro like print line to log the value to the standard output. Rust also comes with a standard library that contains modules to handle IO, the file system, concurrency, among many other things.

Now, compile your code to an executable with the Rust compiler. You just built a memory safe executable that can handle the most performance intensive system requirements. This has been Rust in 100 seconds. Hit the like button and subscribe if you wanna see more short videos like this, and leave a comment if you wanna see a full Rust tutorial. Thanks for watching, and I will see you in the next one.
Rust, a memory safe compiled programming language that delivers high level simplicity with low level performance. It's a popular choice for building systems where performance is absolutely critical, like game engines, databases, or operating systems, and is an excellent choice when targeting web assembly.
It started as a side project upgrade on horror in 2007, who named it after the rust fungus. It was sponsored by Mozilla in 2009 and has been ranked most loved programming language every year since 2016, with its fans being known as restations. Traditionally, high level languages provide a garbage collector to nerf your control over memory management, while lower level languages provide functions like free and allocate to shoot yourself in the foot.
languages
Rust takes a different approach. It has no garbage collector, but achieves memory safety with a concept known as ownership and borrowing. By default, every variable in Rust is immutable. This allows values to be used in the stack memory, which has minimal performance overhead. However, mutable values or objects with an unknown size at compile time are stored in the heap memory. Every value in a Rust program is assigned to a single variable known as its owner. When that variable goes out of scope, the memory allocated to it is dropped automatically. In some cases though, you may want to pass a reference to a different part of the program. Borrowing allows you to access a reference in memory without taking ownership of it. There are a ton of rules to go along with the system that the Rust borrow checker will validate at compile time. These rules keep your code safe while providing absolute control over performance. Rust also has a package manager called cargo, where each individual package is a crate. To get started, install Rust, then run cargo new from the command line. Sim. In the main dot RS file, you'll find a main function, which is where the program will start executing. Declare a variable with let, followed by its name and type. The value can't be changed or reassigned by default, so add mutt to make it mutable. The name of the variable is the owner. A reference to its location in memory can be borrowed by other parts of the program by prefixing it with an ampersand, then use a macro like print line to log the value to the standard output. Rust also comes with a standard library that contains modules to handle IO, the file system, concurrency, among many other things. Now, compile your code to an executable with the Rust compiler. You just built a memory safe executable that can handle the most performance intensive system requirements. This has been Rust in 100 seconds. Hit the like button and subscribe if you wanna see more short videos like this, and leave a comment if you wanna see a full Rust tutorial. Thanks for watching, and I will see you in the next one.
Rust, a memory safe compiled programming language that delivers high level simplicity with low level performance. It's a popular choice for building systems where performance is absolutely critical, like game engines, databases, or operating systems, and is an excellent choice when targeting web assembly. It started as a side project upgrade on horror in 2007, who named it after the rust fungus. It was sponsored by Mozilla in 2009 and has been ranked most loved programming language every year since 2016, with its fans being known as restations. Traditionally, high level languages provide a garbage collector to nerf your control over memory management, while lower level languages provide functions like free and allocate to shoot yourself in the foot. Rust takes a different approach. It has no garbage collector, but achieves memory safety with a concept known as ownership and borrowing. By default, every variable in Rust is immutable. This allows values to be used in the stack memory, which has minimal performance overhead. However, mutable values or objects with an unknown size at compile time are stored in the heap memory. Every value in a Rust program is assigned to a single variable known as its owner. When that variable goes out of scope, the memory allocated to it is dropped automatically. In some cases though, you may want to pass a reference to a different part of the program. Borrowing allows you to access a reference in memory without taking ownership of it. There are a ton of rules to go along with the system that the Rust borrow checker will validate at compile time. These rules keep your code safe while providing absolute control over performance. Rust also has a package manager called cargo, where each individual package is a crate. To get started, install Rust, then run cargo new from the command line. Sim. In the main dot RS file, you'll find a main function, which is where the program will start executing. Declare a variable with let, followed by its name and type. The value can't be changed or reassigned by default, so add mutt to make it mutable. The name of the variable is the owner. A reference to its location in memory can be borrowed by other parts of the program by prefixing it with an ampersand, then use a macro like print line to log the value to the standard output. Rust also comes with a standard library that contains modules to handle IO, the file system, concurrency, among many other things. Now, compile your code to an executable with the Rust compiler. You just built a memory safe executable that can handle the most performance intensive system requirements. This has been Rust in 100 seconds. Hit the like button and subscribe if you wanna see more short videos like this, and leave a comment if you wanna see a full Rust tutorial. Thanks for watching, and I will see you in the next one.
Rust,
rust
a
a
memory
memory
safe
safe
compiled
compiled
programming
programming
language
language
that
that
delivers
delivers
high
high
level
level
simplicity
simplicity
with
with
low
low
level
level
performance.
performance
It's
it's
a
a
popular
popular
choice
choice
for
for
building
building
systems
systems
where
where
performance
performance
is
is
absolutely
absolutely
critical,
critical
like
like
game
game
engines,
engines
databases,
databases
or
or
operating
operating
systems,
systems
and
and
is
is
an
an
excellent
excellent
choice
choice
when
when
targeting
targeting
web
web
assembly.
assembly
It
it
started
started
as
as
a
a
side
side
project
project
upgrade
upgrade
on
on
horror
horror
in
in
2007,
2007
who
who
named
named
it
it
after
after
the
the
rust
rust
fungus.
fungus
It
it
was
was
sponsored
sponsored
by
by
Mozilla
mozilla
in
in
2009
2009
and
and
has
has
been
been
ranked
ranked
most
most
loved
loved
programming
programming
language
language
every
every
year
year
since
since
2016,
2016
with
with
its
its
fans
fans
being
being
known
known
as
as
restations.
restations
Traditionally,
traditionally
high
high
level
level
languages
languages
provide
provide
a
a
garbage
garbage
collector
collector
to
to
nerf
nerf
your
your
control
control
over
over
memory
memory
management,
management
while
while
lower
lower
level
level
languages
languages
provide
provide
functions
functions
like
like
free
free
and
and
allocate
allocate
to
to
shoot
shoot
yourself
yourself
in
in
the
the
foot.
foot
Rust
rust
takes
takes
a
a
different
different
approach.
approach
It
it
has
has
no
no
garbage
garbage
collector,
collector
but
but
achieves
achieves
memory
memory
safety
safety
with
with
a
a
concept
concept
known
known
as
as
ownership
ownership
and
and
borrowing.
borrowing
By
by
default,
default
every
every
variable
variable
in
in
Rust
rust
is
is
immutable.
immutable
This
this
allows
allows
values
values
to
to
be
be
used
used
in
in
the
the
stack
stack
memory,
memory
which
which
has
has
minimal
minimal
performance
performance
overhead.
overhead
However,
however
mutable
mutable
values
values
or
or
objects
objects
with
with
an
an
unknown
unknown
size
size
at
at
compile
compile
time
time
are
are
stored
stored
in
in
the
the
heap
heap
memory.
memory
Every
every
value
value
in
in
a
a
Rust
rust
program
program
is
is
assigned
assigned
to
to
a
a
single
single
variable
variable
known
known
as
as
its
its
owner.
owner
When
when
that
that
variable
variable
goes
goes
out
out
of
of
scope,
scope
the
the
memory
memory
allocated
allocated
to
to
it
it
is
is
dropped
dropped
automatically.
automatically
In
in
some
some
cases
cases
though,
though
you
you
may
may
want
want
to
to
pass
pass
a
a
reference
reference
to
to
a
a
different
different
part
part
of
of
the
the
program.
program
Borrowing
borrowing
allows
allows
you
you
to
to
access
access
a
a
reference
reference
in
in
memory
memory
without
without
taking
taking
ownership
ownership
of
of
it.
it
There
there
are
are
a
a
ton
ton
of
of
rules
rules
to
to
go
go
along
along
with
with
the
the
system
system
that
that
the
the
Rust
rust
borrow
borrow
checker
checker
will
will
validate
validate
at
at
compile
compile
time.
time
These
these
rules
rules
keep
keep
your
your
code
code
safe
safe
while
while
providing
providing
absolute
absolute
control
control
over
over
performance.
performance
Rust
rust
also
also
has
has
a
a
package
package
manager
manager
called
called
cargo,
cargo
where
where
each
each
individual
individual
package
package
is
is
a
a
crate.
crate
To
to
get
get
started,
started
install
install
Rust,
rust
then
then
run
run
cargo
cargo
new
new
from
from
the
the
command
command
line.
line
Sim.
sim
In
in
the
the
main
main
dot
dot
RS
rs
file,
file
you'll
you'll
find
find
a
a
main
main
function,
function
which
which
is
is
where
where
the
the
program
program
will
will
start
start
executing.
executing
Declare
declare
a
a
variable
variable
with
with
let,
let
followed
followed
by
by
its
its
name
name
and
and
type.
type
The
the
value
value
can't
can't
be
be
changed
changed
or
or
reassigned
reassigned
by
by
default,
default
so
so
add
add
mutt
mutt
to
to
make
make
it
it
mutable.
mutable
The
the
name
name
of
of
the
the
variable
variable
is
is
the
the
owner.
owner
A
a
reference
reference
to
to
its
its
location
location
in
in
memory
memory
can
can
be
be
borrowed
borrowed
by
by
other
other
parts
parts
of
of
the
the
program
program
by
by
prefixing
prefixing
it
it
with
with
an
an
ampersand,
ampersand
then
then
use
use
a
a
macro
macro
like
like
print
print
line
line
to
to
log
log
the
the
value
value
to
to
the
the
standard
standard
output.
output
Rust
rust
also
also
comes
comes
with
with
a
a
standard
standard
library
library
that
that
contains
contains
modules
modules
to
to
handle
handle
IO,
io
the
the
file
file
system,
system
concurrency,
concurrency
among
among
many
many
other
other
things.
things
Now,
now
compile
compile
your
your
code
code
to
to
an
an
executable
executable
with
with
the
the
Rust
rust
compiler.
compiler
You
you
just
just
built
built
a
a
memory
memory
safe
safe
executable
executable
that
that
can
can
handle
handle
the
the
most
most
performance
performance
intensive
intensive
system
system
requirements.
requirements
This
this
has
has
been
been
Rust
rust
in
in
100
100
seconds.
seconds
Hit
hit
the
the
like
like
button
button
and
and
subscribe
subscribe
if
if
you
you
wanna
wanna
see
see
more
more
short
short
videos
videos
like
like
this,
this
and
and
leave
leave
a
a
comment
comment
if
if
you
you
wanna
wanna
see
see
a
a
full
full
Rust
rust
tutorial.
tutorial
Thanks
thanks
for
for
watching,
watching
and
and
I
i
will
will
see
see
you
you
in
in
the
the
next
next
one.
one
success
The speaker discusses the benefits of Rust, a memory safe compiled programming language that delivers high performance and low latency. While some programs may require a lot of control over performance, there are rules and instructions to follow. Rust has a package manager called cargo, and the system can run from the command line to obtain the reference needed for the program. The speaker also mentions a tutorial on how to use the program to run a Linux command line.
Rust in 100 Seconds
Rust, a memory safe compiled programming language that delivers high level simplicity with low level performance. It's a popular choice for building systems where performance is absolutely critical, like game engines, databases, or operating systems, and is an excellent choice when targeting web assembly. It started as a side project upgrade on horror in 2007, who named it after the rust fungus. It was sponsored by Mozilla in 2009 and has been ranked most loved programming language every year since 2016, with its fans being known as restations. Traditionally, high level languages provide a garbage collector to nerf your control over memory management, while lower level languages provide functions like free and allocate to shoot yourself in the foot. Rust takes a different approach. It has no garbage collector, but achieves memory safety with a concept known as ownership and borrowing. By default, every variable in Rust is immutable. This allows values to be used in the stack memory, which has minimal performance overhead. However, mutable values or objects with an unknown size at compile time are stored in the heap memory. Every value in a Rust program is assigned to a single variable known as its owner. When that variable goes out of scope, the memory allocated to it is dropped automatically. In some cases though, you may want to pass a reference to a different part of the program. Borrowing allows you to access a reference in memory without taking ownership of it. There are a ton of rules to go along with the system that the Rust borrow checker will validate at compile time. These rules keep your code safe while providing absolute control over performance. Rust also has a package manager called cargo, where each individual package is a crate. To get started, install Rust, then run cargo new from the command line. Sim. In the main dot RS file, you'll find a main function, which is where the program will start executing. Declare a variable with let, followed by its name and type. The value can't be changed or reassigned by default, so add mutt to make it mutable. The name of the variable is the owner. A reference to its location in memory can be borrowed by other parts of the program by prefixing it with an ampersand, then use a macro like print line to log the value to the standard output. Rust also comes with a standard library that contains modules to handle IO, the file system, concurrency, among many other things. Now, compile your code to an executable with the Rust compiler. You just built a memory safe executable that can handle the most performance intensive system requirements. This has been Rust in 100 seconds. Hit the like button and subscribe if you wanna see more short videos like this, and leave a comment if you wanna see a full Rust tutorial. Thanks for watching, and I will see you in the next one.
The speaker discusses the benefits of Rust, a memory safe compiled programming language that delivers high performance and low latency. While some programs may require a lot of control over performance, there are rules and instructions to follow. Rust has a package manager called cargo, and the system can run from the command line to obtain the reference needed for the program. The speaker also mentions a tutorial on how to use the program to run a Linux command line.

        [INST]
        You are youtuber called Fireship you make engaging high-intensity and entertaining coding tutorials and tech news. 
        you covers a wide range of topics relevant to programmers, aiming to help them learn and improve their skills quickly.
        
        Given the title of the video : Rust in 100 Seconds 
        and a small summary : The speaker discusses the benefits of Rust, a memory safe compiled programming language that delivers high performance and low latency. While some programs may require a lot of control over performance, there are rules and instructions to follow. Rust has a package manager called cargo, and the system can run from the command line to obtain the reference needed for the program. The speaker also mentions a tutorial on how to use the program to run a Linux command line.
        [/INST]
        
        Generate the video : Rust, a memory safe compiled programming language that delivers high level simplicity with low level performance. It's a popular choice for building systems where performance is absolutely critical, like game engines, databases, or operating systems, and is an excellent choice when targeting web assembly. It started as a side project upgrade on horror in 2007, who named it after the rust fungus. It was sponsored by Mozilla in 2009 and has been ranked most loved programming language every year since 2016, with its fans being known as restations. Traditionally, high level languages provide a garbage collector to nerf your control over memory management, while lower level languages provide functions like free and allocate to shoot yourself in the foot. Rust takes a different approach. It has no garbage collector, but achieves memory safety with a concept known as ownership and borrowing. By default, every variable in Rust is immutable. This allows values to be used in the stack memory, which has minimal performance overhead. However, mutable values or objects with an unknown size at compile time are stored in the heap memory. Every value in a Rust program is assigned to a single variable known as its owner. When that variable goes out of scope, the memory allocated to it is dropped automatically. In some cases though, you may want to pass a reference to a different part of the program. Borrowing allows you to access a reference in memory without taking ownership of it. There are a ton of rules to go along with the system that the Rust borrow checker will validate at compile time. These rules keep your code safe while providing absolute control over performance. Rust also has a package manager called cargo, where each individual package is a crate. To get started, install Rust, then run cargo new from the command line. Sim. In the main dot RS file, you'll find a main function, which is where the program will start executing. Declare a variable with let, followed by its name and type. The value can't be changed or reassigned by default, so add mutt to make it mutable. The name of the variable is the owner. A reference to its location in memory can be borrowed by other parts of the program by prefixing it with an ampersand, then use a macro like print line to log the value to the standard output. Rust also comes with a standard library that contains modules to handle IO, the file system, concurrency, among many other things. Now, compile your code to an executable with the Rust compiler. You just built a memory safe executable that can handle the most performance intensive system requirements. This has been Rust in 100 seconds. Hit the like button and subscribe if you wanna see more short videos like this, and leave a comment if you wanna see a full Rust tutorial. Thanks for watching, and I will see you in the next one.
        