►
Description
RustConf 2018 - Rust and the Web Platform: A Rookie’s Guide by Sarah Meyer
Have you heard the good news about WebAssembly? Since the unlamented demise of Flash, the only choice for writing web applications has been everyone's favorite punching bag of a programming language: JavaScript. WebAssembly defines a new binary format for code that can run natively from all major browsers. The best part is that you can write WebAssembly code in Rust to benefit from Rust's performance and safety guarantees in a place that's never seen them before: the web! Come find out how to get started on your own WebAssembly modules, and contribute to making the web platform a more powerful, useful tool than ever before.
A
Hey
guys,
thank
you
so
much
for
coming
to
rest
conf
and
to
this
talk
today,
I'd
like
to
start
by
thanking
the
organizers
for
inviting
me.
This
is
actually
my
second
rust
conference
period.
I
was
at
rest
fest
at
the
beginning
of
the
summer
and
I'm
really
enjoying
the
community.
So
this
is
a
talk
about
the
web.
Oh,
this
is
me,
I
have
a
name
I
do
so.
What
makes
the
web
work?
What
makes
it
something
that
is
so
useful
to
so
many
people?
Well,
there's
a
number
of
aspects.
A
One
of
them
is
that
we
have
anyone
can
get.
If
you
have
the
internet,
anyone
can
get
on
it.
So
there's
sort
of
an
equality
of
access.
We
have
cool
stuff
like
universal
resource.
Locators
that
mean
anything,
has
a
defined
address
and,
finally,
there's
something
really
cool
which
is
hypertext
now
a
hypertext
kind
of
to
me
reminds
me
of
the
long
efforts
that
people
have
made
to
cite
other
texts
in
their
works
and
traditionally
the
way
that
you
would
do.
A
This
is
with
a
quotation
most
like
works
of
famous
literature,
especially
when
there
were
not
many
works
of
famous
literature.
We're
so
well
known
that
you
could
just
use
the
same
words
and
have
that
be
a
sort
of
accepted
method
of
referring
to
another
work
and
calling
in
all
of
its
of
all
of
its
echoes
into
your
own
later.
You
know,
as
there
got
to
be
much
more
literature
in
the
world
and
we
needed
a
more
rational
method
of
organizing
it.
We
developed
the
citation,
but
hypertext
was
something
a
little
bit
different.
A
What
did
hypertext
give
us
that's
different
from
earlier
technologies,
instant
gratification.
So,
rather
than
having
to
look
up
a
citation,
you
know
perhaps
a
very
lengthy
period.
You
could
go
from
document
to
document
as
fast
as
your
internet
speed
would
allow.
So
who
is
it
that
we
have
to
thank
for
this
miracle?
It
is
our
favorite
gentleman
Tim
berners-lee
I
would
like
to
thank
him
for
so
much
most
of
all
the
Internet
and
the
web.
A
We
all
know
and
love,
but
also
for
just
being
a
very
unproblematic
man
for
about
thirty
years,
he's
like
an
Anglican
vicar
he's
involved
in
charity,
he's
been
married
to
the
same
woman
for
like
22
years
seriously.
We
stand
an
unproblematic
King,
so
this
slightly
minimized
screenshot.
Perhaps
he
may
recognize
it.
This
is
famously
the
first
page
of
the
web
and
those
beautiful
little
blue
links
are
the
only
form
of
interactivity
on
this
document.
A
A
Basically
these
this,
this
instant
gratification
of
having
all
the
content
linked
from
one
document
to
another
made
people
start
wishing.
They
could
do
more
things
with
these
documents
made
people
want
to
expand
the
capabilities
of
what
they
were
looking
at
and,
of
course,
the
people
who
wrote
HTML
are
not
necessarily
the
ones
who
began
this
job
of
trying
to
make
web
pages
interactive.
Tim
berners-lee
was
a
physicist
working
for
CERN.
He
dr.
the
document
model
was
something
that
probably
was
enough
for
him
for
a
while,
but
not
for
a
lot
of
Internet
users.
A
So
this
also
quite
quite
small
screenshot-
is
of
a
Java
applet,
so
Java
applets,
oh
man,
they
came
out
so
early.
They
were
released
with
the
first
version
of
Java
because,
like
Java,
even
though
we
think
of
it
as
a
like
systems
and
like
back-end
programming,
language
always
was
trying
to
kind
of
bridge
this
gap
between
the
server
and
the
client.
So
one
of
the
cool
things
about
Java
applets,
what
they
was
that
they
were
deliberate,
is
Java
bytecode,
so
they
were
quite
small
in
terms
of
download
size.
A
Well,
of
course,
that
does
depend
on
whether
you
actually
had
Java
already
installed
to
your
machine.
You
might
have
a
very
hefty
download
in
between
you
and
whatever
piece
of
content
you
were
looking
at.
So
that's
one
of
the
like
slightly
less
user-friendly
aspects
of
Java
applets,
but
there
were
some
aspects
that
were
really
really
nice.
Java
code
obviously
could
run
on
any
machine
that
ran
Java
and
what
was
the
the
Brad
about,
like
1
billion
devices
running
Java
in
2000,
something
well
even
back,
then
there
were
a
lot
of
lot
of
devices
running
Java.
A
A
A
A
So
Java
was
instantly
becoming
very
popular
almost
from
the
moment
of
its
release,
because
it
was
filling
a
need
that
many
developers
had
both
to
have
relatively
accessible
server-side
programming
and
to
again
bridge
that
gap
between
server
and
client.
This
concept
was
gathering
so
much
steam
that
Netscape,
which
had
was
trying
to
release
its
mosaic
killer,
Mozilla
a
browser
at
the
time
and
somebody's
gonna
get
my
I'm
gonna
get
my
facts
wrong
somewhere
in
here,
and
somebody
is
gonna,
have
direct
personal
experience
in
this
audience.
A
I
know
it,
but
there
was
so
much
urgency
that
a
Brendan,
Eich
famously
wrote
this
prototype
in
ten
days.
So
we
wound
up
getting
JavaScript
released
by
the
end
of
1995.
So,
basically,
shortly
after
the
release
of
Java,
it
was
not
called
JavaScript
at
first
I
think
that
was
like
a
slightly
later
version
that
they,
you
know.
Of
course,
they
called
it
JavaScript
to
kind
of
hang
on
to
those
coattails
of
Java
to
this
day,
confusing
people
who
are
very
smart.
A
Like
my
mother,
you
know
she's
really
smart,
but
she
just
can't
remember
that
one
one
of
the
other
interesting
things
about
JavaScript
is
that,
unlike
Java,
which
was
sort
of
a
general
use,
programming
language
with
sort
of
an
API
for
putting
up
like
applications,
javascript
was
designed
from
the
ground
up
with
the
with
HTML
in
mind.
Javascript
was
designed
to
manipulate
HTML
and
that
I
think
is
an
important
aspect
to
its
later
success.
A
Another
important
aspect
to
its
later
success
was
how
much
people
started
trying
to
copy
it
like
this
was
an
era
of
like
all
proprietary
code.
Nobody
was
sharing
their
code.
Well,
maybe
not
nobody,
but
none
of
these
people
were
sharing
their
code
so
for
Microsoft
to
actually
get
a
their
own
JavaScript
version
up.
They
basically
just
looked
at
what
was
running
in
Netscape
browsers
and
copied
it
and
re-implemented
it
with
their
own
engineers,
which
is
like
very
1996,
but
also
kind
of
a
crappy
way
to
work.
A
But
then
we
have,
oh
god,
most
blessed,
there's
one
other
very
popular
option
for
interactivity
on
the
web
and
it
is
flash.
This
is
an
old
flash
website,
so
flash
came
out
almost
right
after
JavaScript.
They
are
like
on
each
other's
heels,
because
clearly,
this
is
the
movement.
This
is
what
people
want
out
of
this
brand-new
technology
called
the
web.
So
one
of
the
cool
things
that
I
found
out
when
I
was
researching.
A
So
this
and
the
fact
that
it
flash
had
an
amazingly
accessible
toolkit,
because
again,
it
hadn't
been
originally
developed
for,
like
technical
users
coders
as
opposed
to
the
earlier
technologies
that
we're
talking
about
which,
while
they
were
relatively
user,
friendly
scripting
languages
still
had
that
barrier
of
assuming
that
somebody
knew
how
to
code
before
they
started
using
them.
So
flash
really
became
a
colossal
success
until,
of
course,
Steve
Jobs
killed
it
with
the
iPhone,
because
the
iPhone
1
and
flash
when
it
not
supported
darling
iPhone,
could
not
succeed.
A
This
is
despite
some
very
legitimate
attempts
that
flash
made
to
converge
back
into
the
JavaScript
standard,
with
something
like
action.
Script,
which
was
a
implementation
of
I,
think
an
early
ECMO
script
spec,
but
they
never
brought
them
back
together
and
flash
unfortunately
died
or
did
it.
This
is
a
screenshot
I
took
like
yesterday
from
a
paper
doll
game
that
was
released
about
three
weeks
ago.
A
A
So
all
of
this
together
was
the
birth
of
the
web
platform,
because
these
competing
visions
of
what
interactivity
on
the
web
was
going
to
look
like
ignited
of
what
we
call
the
browser
wars,
and
this
was
basically
a
like
triangular
conflict
between
browser,
vendors
browser
users
and
application
developers.
The
browser
vendors
wanted
to
offer
features
that
would
be
so
attractive
to
the
users
that
they
would
choose
their
browser
and
not
somebody
else's,
but
application
developers
wanted
their
programs
to
run
on
every
browser
with
the
same
behavior.
A
This
conflict
eventually
led
to
the
creation
of
atma
script,
which
is
not
in
itself
a
language.
So
much
as
it
is
a
specification
for
a
language
and
basically
Eknath
script
was
developed
by
looking
at
all
the
disparate
JavaScript
implementations
that
existed
at
the
time
and
trying
to
find
the
commonalities
in
them
so
that
they
could
be
defined
so
that
anyone
could
use
them
so
that
in
the
future,
if
somebody
were
coming
up
with
a
new
browser,
they
wouldn't
have
to
just
like
kind
of
feel
out
how
JavaScript
is
supposed
to
work.
A
They
could
actually
know
how
it's
supposed
to
work
defined
standards
that
if
they
meet,
they
know
that
they're
offering
a
good
experience
both
to
developers
and
to
users.
So
that
said,
though,
this
birth
was
much
less
like
this
and
much
more
like
this
Saturn
eating
his
own
children.
It
was
a
brutal
conflict
red
in
tooth
and
nail
and,
as
we
all
know,
there
were
casualties
like
Netscape,
but
there
were
also
huge
wins
for
the
community.
A
This
open
source
governance
model
was
so
successful
with
JavaScript
that
that,
for
that
reason,
and
for
other
reasons,
it
began
to
be
the
accepted
way
of
developing
software
that
you
wanted
a
wide
variety
of
people
to
use.
This
was
an
era
of
increasing
standardization,
both
with
like
IETF
standards
for
like
web
and
Internet
technologies,
and
for
a
standardization
of
stuff
like
the
w3c,
was
actually
predates
the
browser
Wars
slightly
because
it
existed
to
standardize
HTML
even
before
anyone
was
thinking
of
trying
to
standardize
javascript.
A
So
javascript
has
one
right.
Nobody
out
here
is
writing
Java
applets
seriously
to
my
knowledge
and
flash
well,
we've
established
that
people
are
still
using
it
quite
actively.
It
is
obviously
deprecated
by
all
the
major
browser
vendors
and
has
no
support
on
the
mobile
devices
that
we
consider
to
be
so
important
in
this
day
and
age,
but
God
JavaScript
man
I've
been
writing
JavaScript
for
like
five
and
a
half
years
now.
People
pay
me
to
do
it
and
everything
and
it's
fun
a
lot
of
the
time.
A
It's
fun
because
of
how
close
JavaScript
is
to
me
anytime,
I
want
to
I,
can
just
open
up
a
terminal
and
there's
my
repple
wow.
That's
that's
pretty
neat,
that's
pretty
easy,
but
there
are
other
aspects
of
the
JavaScript
experience
that
are
not
so
good
performance,
of
course,
is
one
of
them.
Javascript
is
a
scripting
language.
It
has
to
run
inside
like
a
small
subset
of
your
computer's
resources
and,
while
browser
vendors
are
always
trying
to
optimize
for
the
way
that
people
write
JavaScript.
A
This
does
create
a
sort
of
situation
where
there's
a
bit
of
tail
chasing
JavaScript
vendors,
optimise
common
patterns
and
then
kind
of
institutionalize
what
might
or
might
not
be
good
programming
behavior.
So
many
people
don't
want
to
write
JavaScript,
but
on
the
other
hand
the
web
seems
to
have
one
more
and
more
applications
that,
in
a
previous
era,
would
have
been
would
have
been
native
applications,
perhaps
on
your
desktop
computer
are
now
web
applications.
A
Well,
people
started
feeling
out
this
problem
almost
immediately.
Javascript,
of
course,
has
not
been
popular
among
large
swaths
of
the
community,
so
one
of
the
original
solutions
that
people
came
up
with
was
Assam.
Jas
Asmodeus
basically
took
advantage
of
a
number
of
like
performance,
hacks
of
JavaScript
stuff
like
doing
8du,
adding
bitwise
operators
to
all
of
the
integers.
He
were
using
in
JavaScript
code,
which
was
a
hack
that
would
make
them
be
treated
like
more
like
native
data
structures
than
like
JavaScript
data
structures.
A
So
what
Adam
today
is
basically
was,
though,
was
kind
of
hack
for
people
who
didn't
want
to
write
JavaScript
to
not
write
JavaScript,
they
would
write
C
or
C++,
or
maybe
even
rust,
actually,
because
those
timelines
do
sort
of
overlap
and
just
run
a
compilation
step
on
it.
That
would
turn
it
into
JavaScript
that
boasted
native
performance
owing
to
how
it
was
optimized.
A
But
that
was
not
the
only
proposal
for
getting
native
level
of
performance
in
a
seamless
way
in
web
browsers.
There
was
also
the
Google
Native
Client,
which
was
abbreviated
as
NaCl
like
salt.
So
there
were
a
lot
of
pretty
bad
pepper,
jokes,
like
salt
and
pepper
for
their
project.
Names
bless
all
Google
employees,
so
this
actually
is
like
quite
an
old
project.
2011
I,
don't
know,
I
feel
like
that
was
forever
ago
like
I
was
I
was
a
young
man,
and
this
was
a
chrome
only
solution,
not
shockingly
because
it
was
a
proprietor,
a
busy.
A
It
wasn't
a
proprietary
Google
product
exactly,
but
to
quote
somebody
from
Mozilla
in
like
2012,
it
was
an
open
specification,
open
specification
beyond
its
chrome
implementation,
so
there
was
basically
no
way
that
people
were
going
to
really
adopt
Google
Native
Client.
Unless
chrome
became
the
only
browser
people
used,
and
that
is
not
what
happened.
A
I,
can't
read
it
or
make
sense
of
it.
You
probably
can't
either
no
matter
how
good
your
brain
is
and
then
the
other
one
is
a
more
comprehensive
and
maybe
kind
of
human,
readable
and
editable
assembly
like
format
which
you
can
hand
edit,
if
you
would
so
choose,
but
that's
probably
not
what
you
want
to
do.
You
probably
want
to
write
code
in
something
like
C,
C++,
Ruby,
no,
not
Ruby.
Why
don't
I
just
say
that
I'm
entrust
and
it
was
initially,
the
initial
features
were
based
on
the
as
MJS
feature
set.
A
So
again,
this
kind
of
model
of
looking
at
what
exists
out
there
implementing
all
of
its
features
and
then
trying
to
supersede
it,
which
we
see
again
and
again.
You
know
in
computing.
That's
how
we
work.
We
want
to
make
something
better
and
then
we
want
to
make
it
much
better.
We
want
to
extend
what
it
does
beyond
what
was
already
possible,
so
web
assembly
is
so
brand
spanking
new.
It
was
announced
in
2015.
A
We
had
a
first
like
unity
demo
in
2016,
and
the
initial
release
was
already
in
2017,
so
that
was
like
last
year
and
now
here
we
are
in
the
middle
of
this
year.
It
is
actually
just
blowing
up
in
terms
of
like
interest.
I
was
at
rest
fest
at
the
beginning
of
the
summer,
and
somebody
did
a
talk
on
you.
A
I
think
it's
still
not
quite
production
ready,
but
the
mere
notion
that
you
can
have
now
a
web
framework
where
you
write
both
a
server-side
and
client-side
code.
A
In
the
same
in
the
same
language
and
then
have
it
compiled
into
JavaScript
wow,
that
is
so
neat
I
have
been
a
web
developer
for
so
long.
One
of
the
things
that
we
are
only
is
chasing
is
isomorphism.
This
notion
that
we
could
have
code
that
will
run
the
same
both
on
the
browser
and
on
the
server,
and
why
would
you
want
this?
Well,
every
time
I
write
something
like
a
forum,
validation,
that's
logic
that
I
have
to
duplicate
both
in
my
JavaScript
and
in
my
Python
Ruby
rust
Java
go
well
that,
frankly,
sucks.
A
First
of
all
the
person
writing
the
Python
Ruby
Rusco
might
very
well
not
be
the
same
person
who
writes
that
javascript
and
they
will
certainly
probably
not
be
the
same
people
maintaining
it.
It
is
just
as
we
if
you
saw
Isis
and
Chelsea's
talk
earlier
about
trying
to
maintain
parity
between
rust
and
C
implementations
of
a
complex
bit
of
logic,
no
matter
how
many
smart
engineers
you
have
it
probably
just
can't
be
done
so
having
code.
That
is
truly
the
same.
A
That
runs
the
same
with
the
same
assumptions
is
something
that
I
have
been
interested
in
for
a
long
time
and
I
sort
of
I
taste
it
coming
with
webassembly,
it's
so
close
and
there's
some
tools.
I
want
to
call
out,
especially
in
the
rust
community.
One
of
them
is
Waze
and
bind
gen,
which
is
what
we
use
to
sort
of
pass
functions
and
data
structures
over
that
rust
webassembly
border,
and
then
we
have
Waze
and
PAC,
which
is
an
incredibly
cool
tool
that
lets
you
package
up
rust
as
NPM
modules.
A
So
you
can
have
your
rest
code
running
in
a
browser
extremely
easily,
with
a
minimum
set
up
from
you.
So
now
this
brings
us.
This
brings
us
to
me
actually
Tommy,
that's
Ashley,
but
I'm
here
because
of
Ashley,
because
Ashley
tweeted
at
the
beginning
of
the
summer,
about
a
program
called
rust
reach,
which
is
basically
intended
to
give
people
who
were
not
currently
involved
in
rust,
some
mentorship
a
project
to
work
on
and
try
to
get
them
more
involved
in
the
rest
community.
A
A
So
the
broader
a
base
of
people
that
we
get
into
this
rust
and
webassembly
community,
the
more
likely
that
this
standard
is
going
to
be
successful
because
it
hasn't
won
yet
so
the
this
so
tiny
screenshot
is
just
a
couple
of
my
friends
from
rust
reach
having
our
weekly
call
where
we
talk
about
our
projects
and
what
we
were
working
on.
A
One
of
those
people
is
in
the
audience
crystal
girl
and
I
just
want
to
say
that
this
experience
was
incredibly
important
to
me
because,
like
I
said,
I've
been
a
web
developer
for,
like
almost
six
years
now,
I
never
thought
that
systems-level
programming
was
something
that
I
could
do,
not
because
I
didn't
think
I
had
the
brains
for
it
or
something,
but
just
because
I
was
out
of
college.
Where
was
I
gonna
get
that
kind
of
training
was
I
gonna
go
back
to
school,
just
to
learn
assembly.
A
No,
but
rust
was
kind
of
here
when
I
needed
it
and
rust
was
welcoming
to
me
when
I
needed
it
to
be
welcoming,
and
there
is
so
much
that
I
have
learned
just
about
how
computers
really
work
from
this
last
summer's
experience
of
working
on
with
rust.
It's
like
a
whole
new
computer
science,
education
for
somebody
who
really
missed
that
experience
in
college.
A
So
I
also
want
to
talk
again
a
little
bit
about
those
tools
that
we
have
in
rust
and
webassembly
and
I
want
to
shout
out
to
Nick
Fitzgerald
Fitz
John,
who
is
really
a
leader
and
the
rest
was
a
working
group
and
has
also
been
very
personally
welcoming
to
me
and
to
my
contributions
on
these
projects.
Basically,
all
I've
been
doing
so
far
is
a
little
bit
of
documentation
here
and
there.
But,
despite
that,
nobody
expected
me
to
come
in
with
like
some
great
ground
baked.
A
Breaking
PR
and
I
wouldn't
be
accepted
unless
I
refactored
the
whole
language
on
my
first
day,
which
definitely
was
always
my
fear
with
OSS,
but
it
wasn't
the
case
at
least
in
this
community
people
were
encouraged
me
to
ramp
up
slowly
and
gave
me
the
space
I
needed
to
get
comfortable
with
what
I
was
looking
at.
So
that
also
means
that
I
started
working
on
something
we
call
the
the
game
of
life
tutorial
in
brest
wasum.
A
Now
the
game
of
life
Conway's
Game
of
Life,
if
you're
familiar
with
it,
is
a
fun
sort
of
computational
game
with
simple
rules,
as
you
can
see,
we
have
a
grid
with
cells.
The
rule
is
that
any
cell
with
two
or
three
neighbors
any
live
cells.
Two
with
your
neighbors
survives.
If
it
has
a
different
number
of
live,
neighbors
it
dies
and
a
dead
cell
with
exactly
three
neighbors
will
become
alive.
A
A
Yeah,
so
I
had
a
different
computer
up
until
like
two
years
ago.
This
is
a
little
2011
MacBook
Air,
that's
doing
its
utmost
with
its
four
gigs
of
ram.
I
cannot
actually
compile
the
upper
levels
of
the
game
of
life
on
my
computer,
which
is
a
really
fun
cool
problem
that
has
prevented
me
from
doing
the
live
demo
that
I
wanted
to
do
at
this
talk,
but
I
think
you
guys
will.
Forgive
me
right.
Thank
you.
Thank
you.
A
I
really
appreciate
it,
so
that
kind
of
brings
me
to
another
project
I
worked
on,
which
was
just
to
automatically
generate
read
nice
for
the
exported
typescript
files
that
are
generated
when
you
run
some
rest
code
through
Waze
and
PAC
and
I'm
still
working
on
that
I
learned
a
lot
about
Nam
and
like
parsing
in
rust,
and
it's
a
real
joy,
but
like
multi,
multiple
functions
in
one
file
aren't
working
right.
Now:
it's
okay,
it's
okay,
we'll
keep
working
on
it
and
for
that
I
actually
want
to
really
thank
my
friend,
Michael
Cato.
A
Let's
see
who
worked
with
me
on
that
project
and
he
was
my
mentor
throughout
rust
reach
because
again
he
really
did
the
work
of
letting
me
know
that
I
could
do
this
and
helping
me
with
it
in
a
very
empowering
way.
So
this
might
be
familiar
to
you.
It
was
linked
from
the
very
bottom
of
that
screenshot
I
showed
you
earlier.
This
is
the
original.
How
can
I
help
page
of
the
web,
because
Tim
berners-lee
baked
that
in
to
that
first
web
page?
This
call
for
contributions.
A
A
So
we
can
solve
things
like
this
problem
and
where
I
can't
compile
on
a
machine
before
gigabytes
like
that's
solvable,
maybe
I
can't
solve
it,
but
I
think,
maybe
one
if
you
can-
and
that
is
the
thing
that
keeps
me
so
endlessly
excited
about
technology,
the
internet
and
the
web.
There
is
always
someone
out
there
who
wants
to
solve
your
problem.
A
So
I'm
really
grateful
to
the
people
who
have
worked
on
all
the
technologies
that
support
the
technologies
that
I
write
now
because
it
has
taken,
it
has
taken
not
just
a
village
but
an
entire
world
of
programmers
years
and
years.
To
get
to
this
point
that
we
are,
we
all
stand
on
the
shoulders
of
giants
and
I'm,
like
literally
looking
at
some
of
my
Giants
right
in
this
audience
here.