►
From YouTube: Intro to the Rust programming language
Description
Alex Crichton presents an introduction to the Rust programming language.
Presentation slides: http://people.mozilla.org/~acrichton/rust-talk-2014-12-10/#/
Presented at Code & Supply in Pittsburgh, PA. Learn more at http://www.codeandsupply.co
A
All
right,
hello,
everyone,
my
name,
is
Alex
Creighton
and,
as
I
was
so
aptly
introduced.
I
work
on
rusted
Missoula
I'm,
going
to
be
doing
one
of
my
favorite
things
tonight,
which
is
talking
about
breasts.
So
first
thing:
first
things:
first
brushes
they've
heard
when
language
coming
out
of
Mozilla
research,
so
what
I
primarily
employed
by
it's
kind
of
the
sponsor
behind
the
language?
A
Larger
than
muslimah,
but
they're
kind
of
driving
it,
which
is
for
early
on
so
first
off
I,
thought
I'd,
tell
you
what
is
rust.
So
if
you
go
to
wrestling
that
organ
you
take
a
look
at
our
website.
First
thing,
you'll
see
is
rust
as
a
systems,
language,
our
systems,
programming,
language
that
runs
blazingly
fast,
prevents
almost
all
crashes
and
eliminates
eight
races,
and
then
this
is
kind
of
like
a
little
sample
of
syntax.
You
can
see
it'll
see
like
some
some
fun.
A
These
fun
things
you
can
do
it
I'll
kind
of
drill
down
to
these
points
and
I'll
send
out
these
slides
later
I
have
these
links
at
the
bottom
called
playtime,
where
you
can
just
click
on
your
run,
run
run
rust
in
your
web.
Browser
I
might
do
that
a
few
times
here.
I
also
want
to
say:
if
anyone
has
any
questions,
feel
free
or
raise
your
hand,
shall
those
things
I
need
to
talk
about
all
right.
A
A
So
a
lot
of
people
see
this
spectrum
of
safety
versus
control
or
sinking
control
versus
web
starting
at
safety
versus
control,
so
C++
and
see
them
when
they
have
a
lot
of
control
over
the
hardware
that
you're
running
on,
so
that
you
can
optimize
it
really.
Well,
you
can
translate
it
directly
to
assembly
code,
like
you
know
exactly
what
you're
writing,
how
it's
can
be
translated,
but
it's
not
very
safe.
A
You
can
get
some
exceptions,
but
that's
pretty
pretty
contained
you
can't
it's
very
hard
to
have
security
vulnerabilities
vulnerabilities
that
wouldn't
be
provided
otherwise,
but
and
so
in
the
middle.
You
have
these
languages
like
Java,
which
you
can
kind
of
have
some
weird
seg
faults
in,
but
it's
generally
very
highly
performed
with
their
JIT
and
everything
going
on.
But
what
Russ
does
is
Russ
just
steps
off
this
line
entirely
Russ
says
no
we're
going
to
give
you
all
the
control
you
can
have,
plus
all
the
safety
you
can
have.
A
So
this
is
kind
of
a
driving
goal
of
rastas
kind
of
break
this
whole
spectrum
paradigm.
It
was
kind
of
step
completely
off.
So
the
first
thing
I
said,
is
that
it
was
a
systems
Berggren
huge,
and
what
this
really
means
is.
You
can
have
a
lot
of
really
interesting
properties
like
fine-grained
control
over
allocations,
or
did
we
offer
to
require
a
garbage
collector
in
the
way
that
C++
doesn't
there's?
Essentially
no
runtime
at
this
point
and
it's
very
close.
A
A
Clang
and
you
thought
that
it
was
really
a
generator,
it
generated
really
fast
code,
we're
doing
exactly
the
same
thing
and
in
a
lot
of
places,
Russ
can
actually
do
better
than
C++.
Rust
has
a
lot
of
information
about
aliasing
about
how
pointers
work.
I'll
talk
a
little
bit
about
that
all
later,
but
rust
can
actually
a
lot
of
cases.
Get
better
performance
in
C++.
Do
the
optimizations
that
we
can
enable
in
om,
so
one
more
thing
is
Russ
prevents.
Almost
all
crashes
is
what
they
said.
A
So
this
is
kind
of
a
interesting
thing
where
the
rust
is
safe
by
default
questions
like
JavaScript
and
Ruby
and
Python,
where
you
cannot
cycle.
If
you
up,
if
you
you
the
harder
you
try,
but
partly
you
just
cannot
do
it.
So
this
is
a
very
difficult
thing
to
do
when
you
have
this
level
of
control
that
we
give
you
but
from
where
this
from
the
very
sophisticated
type
system,
with
a
lot
of
static
analysis-
and
it's
very
quick
in
represent
a
lot
of
programming
paradigms
very
very
well-
it
was
very
powerful.
A
So
we
illuminate
classes
of
errors
like
seg
faults,
null
pointers,
dangling
pointers,
use
after
free
all
that
fun
stuff
you
associate
with
scenes
plus
it
just
cannot
happen
in
rest.
So
in
the
last
part
of
the
last
part
of
that
little
intro
sentence.
That
I
said
was
in
Linux
data
reasons,
so
this
is
kind
of
sometimes
overlooked
whenever
I've
seen
people
talking
about
brows,
but
this
is
and
what
my
thinking,
one
of
those
powerful
features
of
rust,
where
nowadays,
we
have
these
highly
concurrent
computers
with
tons
of
cores
and
all
these
threads
running
in
parallel.
A
A
Can
never
seg
fault,
you
can
never
cause
an
undefined
behavior.
This
is
much
much
more
powerful
than
a
language
like
C++
keys,
and
this
is
okay.
Look
at
that.
So
I'll
show
how
we
had
these
two
key
concepts
in
ROS
called
ownership
and
borrowing
by
putting
these
things
together,
which
are
very
core
low
level
abstractions.
A
If
you
look
at
our
stats
on
github,
you
can
see
we
have
some
C
for
some
couple:
bundle,
libraries
and
a
lot
shell
scripts
for
installation,
but
most
of
us
all
rests
and
then
the
other
big
consumers
of
rust
today
is
a
project
called
server.
So
servo
is
actually
the
reason
for
rusts
inception.
It
was
owned.
It
is
a
project
to
write
a
totally
parallel
layout
engine
where,
when
I
say
layout
engine
you
can
think
of
things
like
gecko
and
Firefox
or
blinken's
as
in
crow
or
WebKit,
is
in
Safari
and
this.
A
What
several
is
done
is
that
building
a
layout
engine,
something
to
render
HTML
from
the
ground
up,
they
started
it.
Basically,
nothing
so
they're.
Writing
it
all
in
rust,
they're
going
to
make
it
super
fast.
Super
parallel,
super
safe
and
it's
tool
is
so
very
much
work
in
development.
You
can
see
here.
The
picture
on
the
left
is
the
acid
to
test
for
layout
engines,
that's
not
running
on
a
desktop
browser
and
that
one
on
the
right
was
actually
I.
Think.
B
A
A
A
Is
a
C
program
which
can
go
wrong
fairly
easily,
so
I
have
this
main
function
was
kind
of
allocating
memory
puts
store
some
information
into
it
and
then
I
pass
it
over
to
a
helper
function.
Now,
what's
conceptually
having
you
have
it
in
here?
Is
this?
This
pointer
called
slot
is
actually
being
consumed
by
the
helper
function
beneath
it
because
it's
created.
A
A
Same
code
to
rest,
it
looks
a
lot
like
this,
so
this
first
line
is:
let's
slot
equals
box.
Three
boxes
are
allocation
operators.
So
what
this
is
creating
is
a
heap
allocated
integer
for
the
value
three
and
then
I
pass
it
to
this
helper
function.
Exhibit
I'm
of
it
is
box
of
it's
kind
of
like
generic,
syntax
and
c++
if
you're
familiar
with
that
and
I
just
printed
out,
but
the
key
part
of
this
program
is
that
this
doesn't
actually
comply
on
that
second
called
the
helper
function.
A
A
So
it's
not
very
useful.
Only
I
can
never
hold
on
to
something
I
kind
of
wanna
be
able
to
transfer
it
along.
So
one
part
of
ownership
is
you
can
definitely
once
you
own
something?
You
could
then
just
decide
to
pass
it
to
someone
else.
So
if
I
have
a
book
and
I'm
done
reading
it,
I
can
give
it
to
someone
else.
Permanent
and
I.
Don't
have
to
so
worry
about
it
again.
A
So
in
this
case
we
just
have
a
helper
function
which
allocates
the
memory
and
then
transfers
it
back
to
the
main
function,
but
returning
it.
So
we
can
see
the
main
function
now.
At
that
point,
you
can
kind
of
do
whatever
it
wants
with
it
and
then
the
the
other
part
about
ownership
is
it's
a
very
deep
property,
so
the
rust
has
structures
which
are
kind
of
are
they're,
basically
just
a
bunch
of
types
that
are
together
with
a
bunch
of
name
fields.
A
So
here
I
have
this
a
structure
which
internally
has
a
B
starts
to
register
line.
Has
that
box
of
it
int,
which
is
a
known
value
and
I,
can
see
that
once
I
pull
it
out,
so
I
can't
create,
and
then
the
C
variable
owns
owns
that
box
and
two
I
can
no
longer
access
it
there
later.
So,
when
I,
try
and
compile
this
program,
this
last
line
is
an
error,
because
a
dot
B,
no
longer
owns
or
C
owns
a
dot
B
at
this
point,
so
I
can
access
it.
A
So
it's
not
very
useful
programming.
Language
of
all,
I
can
do,
is
I'm
going
to
value
and
then
transfer
that
one
value
all
around
like
a
lot
of
times.
I'm
kind
of
wanted
I
want
to
keep
this
value
or
I
want
to
have
to
give
it
to
someone
and
return
it
back.
So
another
Auto
mothership
comes
borrowing,
so
borrowing
is
a
concept
in
respirating
you
something
but.
B
A
B
A
The
main
function
is
doing:
is
it's
loaning
a
reference
into
this
helper
function,
which
means
the
helper
function
is
just
borrowing
it.
It's
not
actually
consuming
ownership
and,
as
an
helper
is
a
little
limited
in
what
I
can
do
with
it.
I'll
talk
about
that
in
a
second,
so
one
of
the
key
parts
of
borrowing
is
a
borrowed.
Value
is
only
valid
for
a
particular
lifetime,
so
a
lifetime
is
something
that
we
call,
which
essentially
amounts
to
a
region
of
code
that
are
a
span
of
code.
You
can
also
think
of
it
as
a
young.
A
A
But
that
doesn't
actually
compile
them.
The
reason
for
that
is
that
the
lifetime
of
this
variable
is
constrained
to
this
scope,
but
because
this
is
outside
that
scope,
there's
no
possible
way
that
this
can
actually
record
something
inside,
so
that
adds
a
bigger
compile
time.
So
the
lifetime
is
kind
of
the
amount
of
time
which.
A
And
you
cannot
access
it
outside
of
my
lifetime,
that's
the
whole
preventing
use
after
freeze
or
preventing
dangling
fighters.
So
in
this
case
it's
totally
funny
because
I
didn't
because
a
AVR
the
same
scope,
then
the
lifetimes
end
up
being
connected.
I'll,
just
fine
I
can
access
I
can
use
a
it
can
use
B,
even
if
it
was
happy.
A
So
a
borrowing
is
a
interesting
concept
where,
whenever
I
move
thing,
I'm
kind
of
transferring
ownership
and
that
like
what
that,
what
that's
compiled
to
with
the
low-level
is
actually
kind
of
copying
and
moving
addresses.
So
that
means,
if
I,
have
a
borrower,
pointer
and
I
move.
The
previous
thing.
B
A
B
A
Declare
a
vector
called
attitude
and
the
right
beneath
a
ticket
bar
go
to
it,
so
I'm
just
going
to
crack
holder
and
stir
it,
but
I
can
no
longer.
This
is
passing
it
trying
to
transfer
ownership
to
someone
else,
but
if
this
is
a
composite,
an
error
because
there's
an
active
barter
with
scope
and
I
can
still
use
that
after
a
function
when
that
would
not
add
anything
on
so
this
function,
which
does
compile.
A
So
a
common
mistake
and
see
a
lot
of
times
we
go,
which
is
kind
of
the
one
of
the
canonical
air
bubbles.
Is
you
you
declare
something?
Let
me
stack
and
then
you
return
a
reference
to
it.
A
lot
of
static
analysis
tools
can
kind
of
figure
this
out
today,
but
this
is
pretty
common
and
they're
very,
very
easy
to
make
mistake
when
you're
time
starting
off
and
see
so
when
you
run
this
in
rust,
which
is
this
is
kind
of
a
rustic
a
little
trying
to
return
a
stack
ownership.
Stack.
A
B
A
I,
just
there's
no
there's
no
way
that
I
can
return
a
valid
reference
when
it's
constrained
to
just
my
stack
itself.
So
we
can
see
from
here
that
borrowing
allows
us
to
kind
of
connect
times
in
the
sense,
and
we
can
say
that
this
function,
signature,
there's
just
nothing
I-
can
do.
I
can't
actually
return
that
value
there,
preventing
you
from
using
X
from
using
stack
frames
too.
By
the
way
things
don't
so.
Barros
can
also
be
nested,
which
is
where
I
can
kind
of
take
a
borrow
and
produce
a
new
bar.
So.
A
Have
this
structure
within
their
value
and
then
this
function
goes
through.
Maybe
it's
taking
a
borrow
structure
and
then
it's
returning
the
borrow
a
borrow
planner
into
the
inner
value
itself.
So
all
this
is
really
getting
compiled
down
to
is
what's
our
pointer
arithmetic,
but
what
Pilar
is
doing
is
the
profile
is
actually
having
tons
of
inference
here.
So
it's
saying:
okay,
this
pointer
is
valid
for
each
pair
lifetime,
so
I.
A
A
A
A
lot
of
times,
you'll
necessarily
want
to
work
with
borrowed
values,
although
all
over
the
place,
you'll
end
up
kind
of
hitting
some
errors
in
the
borrow
checker
of
the
compiler,
where
it
says
some
a
times
or
mismatching,
or
you
can't
extend
the
lifetime
long
enough
or
can't
match
lifetimes.
So
in
this
case
a
lot
of
times,
you
want
to
go
from
a
borrowed
reference
to
a
known
value.
So
in
this
case.
B
A
A
So,
given
those
two
kind
of
core
concepts
of
ownership
and
borrowing,
I
want
to
explain
a
little
bit
how
it
goes
plays
into
the
app
what
we
can
build
on
top
of
it
and
one
of
those
in
every
management
system
of
rust.
So
rust
has
a
very
fine-grained
control.
My
management,
you
can
say
precisely
when
it's
allocated
precisely
when
it's
D
allocated
and
you
have
a
lot
of
control
over
that
kind
of
like
in
C++.
But
the
difference
with
rust
is
that
once
you
create
memory,
you
never
have
to
actually
freed
it.
A
A
Each
variable
Pat
everything
has
an
owner,
so
I
know
that
this
slot
is
the
owner
of
that
heap,
allocated
integer
and
then
all
I
have
to
do
is
say
when
that
falls
out
of
scope,
because
there's
only
one
owner
I
can
free
the
data.
So
in
this
case,
once
the
function
returns,
the
word
slot
goes
out
of
scope.
It's
it's
still
the
owner
of
its
data.
So
we
can
just
do
gate
at
that
point.
So.
B
A
Is
where,
because
rust
understands
that
there
is
one
owner
of
any
piece
of
data
anytime,
and
it
always
knows
where
that
owner
is
then
whenever
it
goes
out
of
scope,
you
can
just
free
now.
This
is
kind
of
a
powerful
paragraph
which
comes
out
of
leadership.
C++
kind
of
has
this
in
our
AI,
sometimes
where
things
can
go
out
of
scope
and
you
can
run
instructors
and
rushes
kind
of
generalizing.
That's
all
so
make
it
a
time.
A
I
remember
manage,
misses
title
book
which
C++
11
that
has
nowadays,
but
yes,
so
I've
been
talking
about
a
lot
of
unique
ownership
types
where,
with
this
box
operator,
no
one
else
can
actually
hold
this
box.
I
can
pass
up
references
to
the
box,
but
no
one's
going
to
have
a
box.
So
that's
not
always
exactly
what
you
want.
So
Ross
does
also
have
shared
memory,
where
I
can
have
a
reference
piece
of
reference
kind
of
data,
but
we
can
use
ownership
to
kind
of
keep
track
of
this
reference
count.
A
So
each
reference
can
color.
The
this
data
right
here
is
just
a
pointer
and
all
it
is,
is
the
pointer
to
some
data
which
has
reference
count
on
it.
So
when
I
first
created
its
got
or
if
it's
kind
of
one
and
then
I
can
call
the
stuff
OMA,
that
I
was
showing
earlier
to
create
a
new
reference.
So
it
turns
out
the
data
and
data
are
actually
pointing
to
the
same
object
there
in
there
or
they're
the
same
pointer
at
that
point,
but
they're
too,
independently
owned
values,
so
rust
can
track
them
independently.
A
And
that
means
that
when
I
call
the
solution
to
work
with
some
data,
little
sign
copy,
then
this
function
is
consuming
ownership
of
that
point
and
when
it
falls
out
of
school,
it
knows
to
decrement
the
reference
count,
because
it
knows
that
there's
no
way
that
anyone
else
can
be
accessing
this
specific
player
anymore.
So
all
I
have
to
do
is
decrement
the
reference
count
and
then
move
on.
A
A
Over
with
ownership,
you
can
not
only
build
a
unique
ownership
in
the
sense
that
boxes
will
later
have
one
owner
or
the
one
person
having
them,
but
you
can
also
have
shared
memory
where
lots
of
different
pointers
are
all
all
kept
track
of.
At
the
same
time,
it
turns
out
that
reference
kind
of
data
actually
ends
up,
allowing
you
to
build
a
lot
more
interesting
data
structures.
Sometimes
just
he
declare
data.
A
A
In
the
first
one,
I
didn't
say
that
my
local
variable
AO
is
mutable,
so
I
can't
reassign
to
it,
but
in
a
second
one
is
it
I
did
say
was
beautiful,
so
I
can
redo
pre
assigned
to
it,
and
then
mutability
is
also
type
of
a
borrowed
pointer
itself.
So
I've
shown
you
earlier
a
bunch
of
ampersand
references.
These
are
shared
references,
so
that
means
that
can
be
many.
Many
many
references
out
any
one
put
in
time,
but
this.
A
I
can
I
can
mutate,
it
I
can
read,
I
can
not
only
read
from
it,
but
I
can
also
store
right
back
to
it,
so
borrow
planners.
All
can
also
can
freely
coerce
to
learn
another
in
the
sense
that
a
mutable
pointer
can
actually
become
a
read-only
planner
common
sense,
but
you
can't
actually
take
a
mutable
or
read-only
pointer
and
then
they
give
you
a
new
app
later
there's
some
interesting
semantics
around
mutable
pointers
and
I'll
talk
about
those
in
just
a
second,
so
an
interesting
card
immutability
is
that
values
can
actually
be
frozen.
A
So
I
have
this
mutable
back
here
up
here,
but
in
this
scope,
I
take
a
borrow
to
it:
shared
butter
and
Wow.
While
rust
knows
that,
while
there
are
shared
borrows,
you
cannot
have
any
beautiful
Barbies.
So
this
push
function
is
mutating
the
vector
and
Wow,
because
there
is
an
active
borrowing,
scope,
I
can't
actually
take
another
one,
and
then
you
take
the
vector
so.
B
A
Typically
called
iterator
invalidation
and
C++
and
Java
and
bunch
of
other
languages,
or
sometimes
you
get
exceptions.
Sometimes
you
get
seg
faults,
but
this
is
a
carbon
truss
where
we
with
the
borrowing
system.
We
can
track
this
and
make
sure
that
you
never
mutated.
Also
much
all
your
real
regressions
to
it.
So.
B
A
I
come
out
of
that
scope,
though
I
end
up
late
and
I
can
continue,
modify
the
vector
because
borrows
are
all
lexical
scopes
currently
so
life
ownership
mutability
is
a
deep
property
of
the
type
it's
kind
of
inherited
through.
So
this
means
that
if
I
have
this
big
class
of
a
destructor
a
via
the
C,
then
because
the
local
binding
is
mutable
its
inherited
all
the
way
down,
I
can
modify,
see
it
and
modify.
B
and
I
can
also
modify
a
and
I
can
kind
of
do
whatever
with
it
and
then
once.
A
Local
variable
is
not
beautiful,
and
you
know
this
is
actually
shrinks
for
ownership
from
this
local
variable
to
this
local
variable.
It's
kind
of
the
concept
of
moving
things
around
this
word
frozen
is
not
actually
mutable.
So
when
I
try
and
eat
it,
I'm
going
to
get
an
error,
and
this
is
not
going
to
work
out.
Look
though,
if
the
route
binding
itself
is
immutable,
we
can
kind
of
do
it
or
you
want
internally
with
it.
A
So
I've
shown
you
how
using
ownership
and
borrowing
we
can
kind
of
wiki
build
up
memory
management.
We
can
build
up
some
extractions
or
I
mean
ability
which
prevent
things
like
iterator
invalidation,
and
my
video
log
guarantees
about
the
pointers
themselves
and
whether
they're
still
valid
it'll
I.
Having
one
point
in
time,
I
know:
I'm.
A
Find
very
interesting,
which
is
how
we
can
use
ownership
and
borrowing
to
build
up
concurrency
abstractions.
So
this
is
where
rust
is
going
to
fulfill
its
promise
of
preventing
you
from
ever
having
a
data
race.
So
it's
a
bit
of
a
background.
Concurrency
and
rust
is
achieved
with
a
granular
of
OS
thread
and
in
the
past
we've
had
some
we've
played
with
some
green
threading
systems
with
end
end.
A
Writing,
based
on
the
view
you
can
like
go,
but
we
have
since
gone
towards
a
less
overhead
or
not
less
overhead,
but
in
less
less
runtime
by
default
semantics,
in
the
sense
that
whatever
you
spawn
something
you
can
have
a
separate
OS
threading
cannot
run
code
in
it
now.
A
So
the
one
of
the
canonical
ways
to
have
a
date
eraser
have
some
bad
memories.
You
take
the
same
object
from
two
different
threads,
so
in
this
case
I'm
going
to
create
it
up
here
and
then
one
three
I'm
going
to
push
the
word
foo
into
it
and
the
other
in
soap
and
main
thread
because,
first
of
all,
we're
borrowing
or
borrowed
of
it.
So
this.
A
Code
this
this
should
not
compile,
because
this
is
clearly
there
is
the
vector
color
getting
it
corrupted.
So
the
way
that
rust
deals
with
this
is
that
this
proc
here
is
a
form
of
closure
in
rust,
where
a
proc
owns
its
environment.
So
in
this
case
this
vector
was
a
reference.
It
referenced
it
inside
this
procedure.
It
actually
moved
inside
of
it
and
then
because
we
had
moved
inside
of
it
now
we
can
no
longer
access
it
outside
this
code,
so
this
is
actually
compile
time
error,
saying
I'm
using
the
move
W.
A
So
this
is
where
it's
totally
fine
for
anyone
threaded
to
modify
the
inspector,
but
only
one
can
modify
the
time.
So
this
is
where
transferring
ownership
from
the
main
thread
to
the
child
thread,
and
now
it
can
modify
it,
but
it
will
have
to
explicitly
pass
it
back
to
me
if
I
want
to
continue
on
modifying
it.
So
this
is
where
ownership
is
preventing.
A
lot
of
ownership
would
by
default,
prevents
a
lot
of
data
races
because
it's
a
there
is
no
shared
memory.
By
default.
A
You
essentially
have
to
opt
in
to
it
and
I
think.
That's,
that's
not
you,
but
I'll
talk.
A
little
boat
show
number
in
a
second,
so
I
was
talking
about
sending
data
back
to
the
main
thread.
So
this
is
where
channels
are
very
interesting,
concurrency,
primitive,
we're
in
rust.
Oh,
you
actually
create
two
halves
of
a
channel.
A
You
have
a
be
sending
in
or
receiving
end,
so
this
child
captures
the
sending
end
bye-bye
value,
so
it
kind
of
consumes
our
ownership
of
it
and
then
we'll
go
run
some
code
instead
of
the
send
a
message
back
and
this
one
time
do
some
work
and
then
receive
it.
So
it's
kind
of
this
is
a
bit
of
an
interesting
whatever.
A
You
think
of
a
channel.
You
typically
don't
think
of
two
halves.
You
can't
just
want
this
one
thing
you
pass
around
and
kind
of
send
on,
but
in
us,
if
we
were,
if
we
were
to
return
only
one
value
there,
then
what
would
happen
is
if
you
sent
a
message
inside
this
procedure,
you
just
moved
it
inside
there,
so
you
would
no
longer
have
access
to
it
outside
the
procedure.
So
this
is
where,
because
of
the
ownership
system
and
kind
of
move
semantics,
we
actually
have
to
give
you
two
halves
to
a
channel.
B
A
A
Is
it's
preparing
a
little
bit
of
a
hashmaps
kind
of
have
some
vegetable
your
colors
are
and
then
this
art
is
the
interesting
thing.
Well,
that's
very
similar
to
that
RC
that
I
showed
you
earlier,
but
and
the
a
here
stands
for
a
time.
So
RC
was
a
reference.
Counted
pointer
did
not
have
any
Atomics
on.
A
It
was
just
played
all
increments
and
decrements,
but
an
arc
is
an
atomic
or
it's
kind
of
pointer,
which
means
that
all
increments
are
record
increments
and
decrements
are
time,
which
means
that
this
type
is
actually
safe
to
share
them
on
all
friends.
I
can
see
if
they
have
this
among
tons
of
people,
they
can
all
the
frothing
the
ref
count
as
much
as
they
want.
A
It's
all
be
totally
gone,
so
in
this
case
again
like
previously
I
clone
it-
and
that
gives
me
these
two
pointers
point
to
the
same
data,
but
it
means
a
reference
catalyst
art
of
this
preface,
but
this
pointer
is
too
and
then
I
can
independently
move
each
of
them
into
it.
Bitter
threads
and
I
think
print
out.
What's
inside
the
hash
map
from
there.
So
one
thing
I
find
somewhat.
A
With
thread
safety
in
mind,
hash
map
has
no
code
saying
I
should
lock.
This
I
should
make
sure
that
this
is
synchronized.
It's
just
a
plain
old
data
structure,
kind
of
like
what
you
would
write
in
in
Java
or
Ruby
or
C++
you
just
your
data
structure
and
by
default.
Rust
will
actually
make
this
totally
safe,
because
rust
knows
that
when
you're
accessing
a
hashmap
you're,
just
taking
a
shared
reference
and
a
shared
reference
can
be
shared
with
many
people.
You
can
only
read
from
it,
which
means
that
this.
A
A
A
shared
printer,
it
can
only
have
read-only
access,
in
which
case
you
can't
have
databases.
So
in
this
case
the
Ark
is
the
key,
primitive
here.
Where
the
Ark
knows
that
account,
it
cannot
lend
mutable
pointers.
You
can
only
get
a
shared
reference,
organ
part
and
that's
because
arcs
are
shared
on
many
threads
and
you
could
no
longer
can
you
can't
actually
mutate
it
when
you
have
many
many
pledges
to
it
across
beds,
so
this
is
kind
of
just
an
example
of
where
Russ
does
have
shared
memory.
A
B
A
Other
aspects
of
rust
is
just
kind
of
sort
of
language
features
which
are
kind
of
nice
to
have
so
like
in
C
and
C++.
In
many
other
languages.
We
have
aggregate
types
where
you
can
have
name
fields,
you
can
put
it
all.
Together
we
have
tuples,
which
means
that
you
can
kind
of
pack
things
up
and
I
use
any
sort
of
air
to
get
tuple
kind
of
any
length
you
want.
You
can
assign
it
to
a
local
variable.
You
can
do
structure
it
in
a
pattern,
so
you
can
pull
peel
it
all
back
out.
A
We
have
enumerations,
which
are
not
quite
seen:
operations
they're
more
like
SML
and
camel
data
types
and
algebra.
This
is
legality
máximos,
where
each
each
vari
isn't
is
can
have
data
on
which
to
show
you
in
a
second.
But
when
you
have
an
enumeration,
you
can
match
on
anything.
Look
look
at
what's
inside
and
the
compiler
will
automatically
check
that
each
match
statement
is
exhaustive,
which
means
that
you
check
everything
and
you
have
to
explicitly
do
something
for
every
pair
game.
A
So
this
is
the
case
where
you
know
scan
also
contained
data
on
them.
So,
in
this
case,
I
have
many
possible
shapes.
My
circle
can
have
a
center
and
a
radius.
My
rectangle
can
have
a
bottom
left
at
a
top
right
and
if
I
have
a
draw
function
per
se,
I
can
kind
of
match
these
and
I
mean
specialize,
baseball
shape,
shape,
provided.
So
this
is
where
we
depart
a
little
bit
from
C++
enums
I've
seen
C++
genomes
where
these
can
have
data,
but.
A
A
So
I
was
talking
a
little
bit
about
X
and
players,
and
you
actually
get
some
nice
optimizations
around
them.
Where
understand,
when
you're
prepared
C
is
memorable,
the
rest
compiler
guarantees
at
compile
time.
You
can
never
ever
have
a
null
pointer
reference,
but
you
can't
have
a
nullable
reference
in
this
case
with
the
of
canonical
option
type
so
option
rust
has
two
variants
called
Sun
and
none
where
some
has
some
data.
The
nan
has
no
data.
A
So
in
this
case
we
know
that
at
runtime
we
represent
this,
even
though
it's
a
generic
enumeration,
which
generally
has
a
little
bit
of
extra
tag
overhead,
because
it's
a
pointer,
we
can
just
not
null
it
out,
and
so
the
immutable
cleaners
actually
has
some
very
interesting
properties
around
it.
Where
Russ
will
guarantee.
There
is
never
more
than
one
mutable
planner
to
your
data,
anyone
time.
So.
A
Very
very
interesting
guarantee
which
you
can
build
a
lot
of
interesting
abstractions
on
so
if
I
know
like,
for
example,
it's
a
very
it's
in
linchpin
of
safety
percent,
in
the
sense
that
if
I
know
that
I
had
a
mutable
pointer
to
my
hash
map,
I
can
reallocate
anything.
I
want.
I
can
kind
of
reallocate
vectors.
I
can
resize
vectors.
I
can
push
anything
on
again
monomakh
by
my
internal
state,
because.
A
A
A
Pointers
into
a
function
by
default,
we
know
that
own,
alias
and
alias
name
is
kind
of
a
very
fancy
term
for
overlapping
and
LVM
and
OPM
can
enable
a
lot
of
interesting
things
like
vectorization
or
a
lot
of
a
couple
of
mem
copy
acquisitions.
If
it
knows
that
pointers
do
not
elias
coming
into
the
function
itself,
so
rust
has
traits
if
you're
familiar
with
Haskell
I'm
told
these
are
variables
of
tech
classes.
What
this
is
essentially
is
that
a
treat
it
can
be
implemented
by
any
type
and
every
type
will
have
this.
A
One
function
called
clone,
so
this
is
an
example.
Type
is
actually
in
the
standard
library
where
it
says
this
is
how
to
go
from
a
shared
reference
to
an
owner
s.
The
capital
S
self
there
on
the
side
is
actually
just
the
type
of
living
it.
So
this
is
a
trait
which
says
anything.
This
family
of
types
can
go
from
a
shared
reference
to
a
known
to
a
known
value,
an
imitation
of
that.
We
kind
of
alluded
like
this,
so
in
that
point
from
earlier
National
IOU,
my
clone
would
just
set
my
own
X&Y.
A
Paisa
I
have
a
new
version
of
myself
at
that
point.
So
what
what
you
can
end
in
the
most
powerful
thing
you
can
do
with
traits?
Is
you
put
them
in
bounds?
So
this
is
kind
of
how
rust
gives
you
functionality
in
generics?
Rust
has
generic
functions
in
the
manner
that
C++
does
where
we
do.
This
thing
called
mom
or
position,
which
essentially
means
that
if
I
write,
if
I
clone
a
vector
in
Santa
Coloma
vector
of
strings
I'm,
gonna
get
two
copies
of
the
sumption.
A
A
If
we
don't
have
that
bound
that
we
can't
actually
do
anything
with
values
inside
we
kind
of
look
at
them,
we
can
pass
them
on,
but
we
can't
do
anything
because
we
only
know
that
it's
a
no-go
paint
type
T,
so
tricks
allow
us
to
be
to
have
some
more
interesting
functionality
inside
of
generics
generic
functions,
so
I
told
you
a
lot
of
how
rust
is
very
safe
languages,
preventing
all
these
data
races.
It's
preventing
all
these
all
these
weird
bugs
because
like
site
faults
and
use
that
to
freeze,
but
this
is.
A
Where
you
can
break
the
rules
and
that
is
called
unsafe
code,
so
rust
is
a
language
where
he
understands
that
you
cannot
having
all
these
restrictions.
That
I
was
talking
about
earlier,
like
own
values,
with
boxes
and
ourseives
and
all
these
channels.
It's
it's
not
sufficient.
You
can't
do
everything
you
want
to
do
with
just
that
abstraction
those
are
kind
of
the
abstractions
which
we
have
given
you.
A
They
are
very,
very
common,
but
they're,
not
everything
they're,
not
everything
that
everyone
will
think
of
and
for
that
purpose
rust
has
unsafe
code
where
what
happens
is
when
you
turn
on
when
you
allow,
when
you
have
an
unsafe
block,
you're
telling
the
compiler?
No
no
I
got
this.
You
don't
worry
about
this,
so
it
turns
up
a
couple
of
compile
time
check.
So
a
couple
things
are
only
allowed
on
city
code,
so
this
is
we'll
just
have
a
casting
expression
and
peace
this
summer,
constant
start
Union.
A
Those
are
raw
pointers,
this
just
kind
of
values
at
fun,
time
or
values.
At
all
time.
We
know
nothing
about
them,
and
here,
where
do
you
reckon
seeing
the
raw
pointer
and
story
intimate
that
operation
is
only
allowed
and
unsafe
code?
So
the
certain
operations
are
talk
a
little
more
in
a
second,
but
here
you
can
see
that
the
local
variable
a
is
declared
as
three:
it's
not
mutable,
but
in
this
unsafe
code,
I
actually
reset
it
a
four
and
that
printed.
This
is
actually
going
to
pick
four.
It's
not
going
to
print
three.
A
They
run
it.
We
can
see
it
prints
up
for
me,
so
unsafe
code
is
where
you
have
the
opportunity
to
kind
of
break
the
rules
kind
of
get
around
the
type
checker
get
it
so
typed
everybody
can
get
around
the
type
system
in
kind
of
the
ownership/borrowing
system,
where
the
goal
in
Russ
is
to
kind
of
minimize
the
set
of
unsafe
code
in
the
program.
We
understand
that
there
will
be
someone
save
code
with
a
compiler.
Just
don't
understand
that
this
is
actually
a
safe
operation,
but.
A
For
example,
all
you
have
to
do
is
generally
look
at
the
unsafe
box
and
you
can
kind
of
go
from
there,
so
very
much
much
much
smaller,
proportional
to
code
base
to
audit
the
entire
million
million
lines.
That
WebKit
is
so
some
other
unsafe
operations
that
the
compiler
allows
is
I
can
call
it
on
the
safe
function.
So
that's
a
very
powerful
operation
because
we
have
this
very
fun:
pumpkin
called
transmute
or
what
it
does
is
it
takes
a
type
T
and
keys.
Go
type?
U
so,
as
you
can
see,.
A
A
Necessary,
it's
somewhat
like
to
build
these
abstractions
on,
but
this
is
kind
of
one
of
the
building
blocks
that
the
sample
hybrid
allows
you
to
have,
and
then
one
of
the
last
things
that
you
can
do
with
on
state
code
is
you
can
call
external
functions
so
to
rest.
It
SFI
stands
for
foreign
function
interface,
which
is
kind
of
a
fancy
word
for
saying
rust
can
talk
to
see
and
what
rust
does
is
it
gives
you
a
rustic,
the
FFI.
A
Very
very
first
class
and
it's
very
easy
to
talk
to
see
from
rust.
So
in
this
case,
there's
the
rates
s
column
C,
which
is
kind
of
write.
Some
data
center
note
so
I'm.
Actually,
writing
I'm.
Writing
the
hello
world
program
from
the
first
lights
and
essentially
see
at
the
spline,
but
I
have
to
use
this
unsafe
block
to
actually
call
this
function
because
I
had
no
idea
what's
going
to
happen
in
that
function,
they
may
not
even
respect
the
signature.
I
just
wrote
down.
It
may
not
be
a
mutate,
random
things
in
the
stack.
A
A
A
The
entire
system,
not
only
do
they
compile
I
can
C++,
but
they
will
never
call
sex
fall
sick
else,
after
that,
so
rust
is
also
very
good
about
embedding
into
other
languages.
So
one
of
the
primaries
is
a
rust
in
production.
Right
now
is
a
company
called
tilde.
They
have
a
product
called
skylight,
which
is
a
rails
monitoring
app
and
they
have
their
agent,
which
is
collecting
all
the
data
and
crunching
all
the
data
as
off
entirely
within
must.
So.
This
is
a
rust
component,
which
is
plugging
into
arbitrary
Ruby
processes
around
the
world.
A
Everyone's
everyone's
brand
of
rails
process
and
Russ
is
very,
very
good
at
that,
so
the
interface
of
crossing
into
rust
is
very,
very
cheap.
It's
very
easy
to
do.
It's
very
easy
to
embed
rust
into
other
places.
I've
seen
extensions
for
Python
as
well.
Someone
was
actually
recently
working
on.
You
would
write
some
rust
coding,
the
write
some
Python
bindings
and
all
the
unsafe
code
would
be
generated
for
you
and
you
wouldn't
doing
everything
we
tell
is
safe
at
compile
time.
A
You
would
have
to
order
me
and
then
rust
is
also
very,
very
good
and
writing
fast
incorrectly
I'm.
Actually
a
fast
I
mean
this
is
actually
very
very
fast.
So
this
is
simple
as
possible
fast.
It's
kind
of
what
everyone
expects
expects
out
of
a
very
a
very
powerful
optimizing
compiler,
but
at
the
same
time,
Rost
is
very,
very
good,
already
correct
code.
If
I
don't
write
unsafe,
it's
actually
it's
very,
very
difficult
at
this
I.
B
A
A
segfault,
and
if
you
do
it's
a
bugger,
the
compiler
or
a
bug
of
the
libraries,
so
as
an
example
of
this
on
current
rusts
package
manager,
club
cargo
is
entirely
written
with
zero
unsafe
blocks.
So
this
is
a
very
fairly
large
project
project
which
I've
been
working
on
for
a
while,
now
and
I'm
able
to
write
the
entire
thing
with
no
unsafe
code
and
I've
never
had
a
sir
Fault
in
it.
So
this
is
something
that
rust
is
definitely
very
practical
in
in.
A
B
A
A
We've
been
saying
that
for
like
six
years
ago,
but
we're
actually
very
very
close
to
went
out
at
this
time
we
plan
on
having
a
100
beta
or
one
of
alpha
release
out
in
the
early
January
and
from
there
we
will
have
at
most
one
two,
maybe
three
beta
cycles
and
then
from
there.
We
will
have
a
one
over
lease,
so
by
this
time
next
year
we
would
definitely
have
I
want
to
release
an
expected
much
much
much
much
sooner
so
I
will
say.
A
However,
rust
is
a
lot
of
fun
to
work
in
there's
a
great
ecosystem
going
on
now
we
have
our
package
managers
just
kind
of
came
into
existence.
We
have
a
leave
hosting
site
online,
Padre
Pio
and
you
could
kind
of
upload.
All
your
packages
see
everyone
else's
packages.
Explorer
code
from
there
we're
really
active
community
is
a
lot
of
fun
to
play
around
it
and
it's
it's
great
for
actually
writing
a
civil
word
code.
A
If
you
like
to
card,
if
you
would
like
to
start
down
and
kind
of
maybe
write
small
components
here
in
their
graphs
and
kind
of
see
how
it
works
out,
that's
all
I
have
a
couple
links
here
like
the
Oliver
coils.
All
of
our
codes
on
github
in
casual
browse
the
whole
repository.
We
have
a
website
called
rustling
gorga.
It's
got
some
links
to
documentation
to
guides,
which
was
recently
read
and
very,
very
high
quality,
highly
recommend.
A
If
you
want
to
dive
a
little
more
deeper
into
rusting
pounders
this
high-level
overview,
we
have
a
subreddit
which
is
pretty
active
for
lots
of
news
around
Weston,
the
converse
IRC
channel.
One
was
a
lot.
Org
has
hundreds
and
hundreds
people
always
willing
to
help.
That's
lovely.
So
thank
you
for
letting
me
talk
about
rest.