►
From YouTube: Why Rust?
Description
No description was provided for this meeting.
If this is YOUR meeting, an easy way to fix this is to add a description to your video, wherever mtngs.io found it (probably YouTube).
A
Hello
welcome
to
this
screencast
on
why
you
should
use
rust.
My
name
is
Nicholas
misaki's
I'm,
a
member
of
the
West
Corps
team,
and
this
is
kind
of
my
extended
elevator
pitch
for
why
I
think
rust
is
so
cool.
Well
in
the
past,
if
you
needed
to
get
real
control
out
of
your
machine,
make
the
most
of
its
resources.
A
You
only
really
have
one
good
choice,
see
your
C++,
and
this
is
what
we
often
call
systems
programming
right
coding
in
an
environment
where
you
have
limited
resources
and
you
need
to
make
the
most
out
of
them,
and
we
often
think
of
this
as
being
a
kind
of
expert
domain.
But
really
it's
a
problem.
People
hit
with
all
levels
of
experience
and
in
any
language
they're,
just
as
likely
to
run
up
against
resource
limits
when
you're
building
your
first
rails
up,
maybe
even
more
likely
I,
would
say.
A
Then,
when
you're
developing
a
purely
C++
code
base.
Now,
C
and
C++
were
the
languages
of
choice
here,
because
they
offer
great
power.
If
your
machine
is
capable
of
doing
something,
then
you
can
curl
it
up
in
CS
C++
right,
but
as
the
saying
goes,
that
great
power
comes
with
great
responsibility,
any
small
mistake
can
easily
have
catastrophic
consequences
at
best
you
might
get
a
crash.
The
worst
your
program
will
do
something
completely
unexpected
or
open
you
up
to
a
security
vulnerability,
and
this
is
where
I.
A
A
What
we
mean
is
you
should
be
able
to
do
all
those
things
that
used
to
require
C
or
C++,
but
you
should
do
them
in
rust,
where
the
compiler
in
the
language
have
got
your
back
and
those
same
kinds
of
mistakes
that
once
led
to
segmentation
faults,
will
now
take
lis,
lead
the
compilation
errors,
so
you
can
fix
them
upfront,
and
the
really
interesting
thing
about
this
is
that
it
starts
to
open
up
new
horizons.
It
means
that
you
can
write
programs
or
try
things.
A
You
would
not
have
even
considered
writing
before
because
they
were
too
difficult
or
too
risky
or
just
too
much
of
a
maintenance
burden.
Let
me
give
you
some
examples
and
here's
some
Ruby
code.
This
is
a
ruby
method
called
blank.
It's
in
the
standard
library,
it
checks.
If
a
string
is
purely
consists
of
whitespace
it
does
it
with
a
regular
expression.
It's
pretty
simple,
but
as
you
might
expect,
it's
not
all
that
fast.
So
on
the
machine
where
we
did
some
benchmarks,
you
could
see
it
got
about
1
million
iterations
per
second.
A
That
might
seem
like
a
lot,
but
at
some
point
it
was
found
in
a
lot
of
Ruby
on
Rails
apps.
This
is
actually
fairly
high
on
the
profiles
and
it's
it's
a
kind
of
a
big
hot
spot.
So
in
response
to
that,
Sam
saffron
decided
to
rewrite
this
function
in
C,
and
this
is
what
he
wrote
and
you
can
see
it's
a
lot
more
complicated,
but
it
starts
to
pay
off
right
because
before
we
got
1
million
iterations
per
second
using
this
C
version,
you
got
10
million.
So
that's
like
a
10x
performance
improvement.
A
So,
by
the
way,
if
you
used
Ruby
on
Rails,
you
might
want
to
get
this
fast
blink
package.
The
thing
is
that
writing
C
code,
like
this
is
quite
a
big
investment.
Not
only
is
the
code
really
complicated
and
hard
to
get
right,
it
has
a
lot
of
special
cases
for
Unicode
and
so
forth.
It
actually
carries
a
lot
of
risk
with
it.
This
is
Rossi
point
on
handling.
If
you
make
a
mistake
here,
anything
could
happen
right.
A
So
maybe,
if
you're
writing
your
own
ruby
code
and
you
don't
have
Sam
saffron
to
rewrite
it
for
you,
you
might
stick
with
this
Ruby
method
and
think
it's
not
worth
micro,
optimizing
this
not
worth
it.
But
what
if
you
tried
to
use
rust
instead,
all
right,
so
this
were
the
performance
numbers
we
saw
before.
If
we
use
rust,
we
would
see
some.
This
is
an
example
of
how
you
might
write
that
function
in
rust,
and
you
can
see
it
looks
a
lot
different
than
the
C
code.
It's
a
lot
more
higher-level.
A
It
starts
out
by
getting
a
string
slice
from
the
buffer,
so
this
is
a
kind
of
subset
of
a
string
and
then
it
creates
an
iterator
that
yields
up
every
character
in
this
slice
one
by
one
and
it
uses
the
all
function
which
takes
a
closure
and
applies
the
closure
to
each
character,
in
this
case
the
closure
tests,
if
it's
whitespace.
So
this
will
be
true
if
all
the
characters
are
whitespace.
Okay,
so
you
might
think
well.
A
This
is
this
looks
nice,
but
it's
probably
not
gonna
perform
that
well,
but
it
does
it
actually
performs
just
as
well
as
the
C
code.
So
what's
even
so
what's
exciting
about.
This
is
not
only
that
you
can
get
the
performance
of
the
C
code,
but
you
can
get
it
with
this.
Pretty
nice
pretty
easy
to
maintain
code,
that's
written
purely
in
safe
rust,
so
it
has
all
the
guarantees
that
it
won't
trigger
a
security,
vulnerability
and
so
forth
all
right.
A
So
let's
look
at
one
more
example:
now
you
may
have
heard
the
parallel
programming
is
very
hard
to
get
right.
Well,
rust
aims
to
change
that
both
by
offering
API
is
to
make
it
easy
to
write
simple,
parallel
loops
and
by
having
a
type
system
that
prevents
the
most
common
mistakes.
So,
let's
start
here
here
we
see
some
sequential
code.
It's
an
iterator
that
iterates
over
a
list
of
pads
and
then
for
each
path.
A
It's
going
to
load
up
an
image
off
the
disk
and
finally,
by
calling
collect,
will
create
and
return
a
vector
to
the
caller.
So
we
have
a
vector
of
the
loaded
images
now.
This
is
obviously
something
we
could
do
in
parallel.
There's
no
connection
between
these
different
images.
So
how
would
we
do
that?
Well,
we
can
do
this
really
easily
by
making
use
of
a
third-party
library
called
rayon.
So
this
happens
to
be
one
that
I
wrote
when
you
write
extra
and
crate
and
rust.
A
That's
kind
of
a
signal
of
linking
in
a
third-party
library
which
we
call
a
crate
and
now
I
can
take
my
function
and
I
can
simply
replace
the
dot
itter
with
dot
par
error,
and
what
I
get
back
is
instead
of
a
sequential
iterator
I
have
a
parallel
iterator.
It's
going
to
execute
in
parallel
now
there's
a
couple
of
cool
things.
I
want
to
note
here.
First
of
all,
it's
very
cool
that
rayon
is
just
a
library.
A
This
is
not
part
of
the
core
language,
but
it's
able
to
do
these
powerful
and
fundamental
extensions
and
rust
is
really
designed
around
this
idea
of
a
minimal
core,
that's
extended
by
powerful
libraries
and
for
parallelism.
In
particular,
we
have
worked
hard
to
make
sure
that
the
core
rust
language
can
support
a
wide
range
of
parallel
programming
paradigms.
It's
because
parallelism
isn't
really
a
one-size-fits-all
affair
right,
so
rust
offers,
for
example,
these
parallel
iterators
that
make
it
easy
to
do.
A
Data
parallelism
and
data
parallelism
across
your
for
loop,
but
we
also
have
things
like
tasks
and
channels
that
are
kind
of
like
go
or
Leung
shared
data
with
mutexes.
If
you
need
that
and
a
number
of
other
options,
so
things
like
non-blocking
data
structures
are
in
the
works
and
so
forth.
Now,
there's
one
more
aspect,
though,
because
making
parallelism
accessible
is
not
just
about
slick-looking
api's,
you
can
find
those
in
a
lot
of
languages.
A
What
makes
Wes
different
is
that
the
type
system
can
actually
help
and
detect
the
kinds
of
subtle
bugs
that
occur
in
parallel
code
before
they
make
your
code
go
haywire
all
right.
So,
let's
see
what
I
mean.
Imagine
here's
a
modified
version
and
you
see
it's
different
because
it's
going
to
be
counting,
as
it
goes
the
number
of
JPEGs
that
it's
loading
out
of
the
folder
now
the
problem
here
is
that
this
code
is
actually
wrong.
A
It
has
a
subtle
mistake
if
you,
if
you
increment
a
counter
like
this
with
just
a
plain
old
plus,
equals
one
and
two
parallel
threads,
this
will
cause
a
data
race.
The
problem
is,
let's
say,
the
two
threads
might
both
read
the
current
value.
Let's
say
it's
one
and
then
add
one
at
the
same
time.
So
now
they
both
think
the
next
value
is
two
and
then
they
both
store
back
and
your
final
counter
went
from
1
to
2,
but
it
should
have
gone
from
1
to
3
because
there
were
2
threads
incrementing.
A
It
comes
up
with
a
different
answer,
but
you
might
also
not
notice
and
just
keep
going
until
it
shows
up
somewhere
down
the
line.
So
what
would
happen
in
rust
if
you
ran
this
code?
Well,
we'll
never
know
the
answer
to
that
question,
because
you
can't
run
this
code
in
rust.
It
simply
won't
compile
because
rust.
A
A
A
It
means
that
we
both
try
to
learn
from
one
another
as
well
as
to
teach
one
another,
and
that's
what
this
slide,
which
comes
from
Julia
Evans
keynoter
Ruskin's
this
year,
2016
kind
of
gets
across
I
really
liked
it
I
really
like
the
way.
This
slide
shows
that
message
in
such
a
simple
way,
but
we
also
have
kind
of
open
and
welcoming
up
at
the
higher
levels
as
well.
So
we
have
an
open
governance
model,
for
example,
where
all
our
new
features
are
publicly
discussed
and
debated
and
improved.