►
From YouTube: Commingle — Arve Knudsen
Description
From the Rust Berlin's January "Rust and Tell" Meetup (https://www.meetup.com/Rust-Berlin/)
Arve Knudsen: https://twitter.com/hochgenuss
Hosted at Prisma: https://www.prisma.io/
🎥 Filmed by iStream: http://www.istream.pl/
A
Well,
hello,
Marva,
I
work
for
Griffin
the
labs
we
make
the
graph
on
a
visualization
system
in
case
anyone
over.
You
are
familiar
with
that,
but
today
I'm
here
to
talk
about
a
project
I've
been
doing
on
my
spare
time
since
maybe
half
a
year
more
or
less,
directly,
Boston
and
I,
who
had
the
idea
together
and
that
we
kind
of
thought
there
should
be
an
open-source
community
driven
alternative
to
Tomita,
and
this
was
like
before
the
whole
debacle,
where
they
would
start
charging
charging
from
attendees.
A
We
just
thought
there
should
be
something
more
more
aligned
with
the
needs
of
the
of
the
community,
and
we
also
thought
it'd
make
sense
to
make
it
open
source.
And
so
here
we
are
I
have
basically
I
have
a
prototype.
It's
not
it's
not
MVP
level,
yet
there's
at
least
enough
to
this
at
least
something
to
show,
and
so
this
is
like.
A
It's
basically
it's
basically
using
Postgres
on
the
US,
the
database
server
and
then
on
the
back
end.
We
we
use
a
rest
web
server
framework
called
bore
which
is
based
on
this
is
on
top
of
hyper,
which
is
again
on
top
of
Tokyo
I,
guess
how
many
of
you
are
familiar
with
the
Tokyo
async
framework
yeah.
A
few
of
you
so
to
talk
is
basically
like
it's
like
a
it's
unknown
standard
runtime
for
foreign,
doing
async,
programming
on
in
rust
and
the
war
is
basically
kind
of
the
framework.
A
A
Let's
say
gatherings,
I
thought
it'd
be
a
good
idea
personally
to
kind
of
narrow
the
scope
and
focus
on
meeting
the
needs
of
developers
instead
of
having
the
wide
scope
of
meetup,
very
kind
of
like
you're,
serving
like
all
kinds
of
meetups
I've,
also
to
make
something
which
is
more
tailored
to
to
the
youth
to
the
needs
of
others
or
Mike.
Let's
say
my
community
and
our
social
or
social
gatherings.
B
A
B
A
So
the
home
page
is
empty
so
far,
and
so
this
I've
made
a
profile
page,
as
you
see
where
you
can
so
you
can
see
the
the
activity
of
the
of
the
user
and
you
can
see
the
you
can
see
the
groups.
The
user
is
part
of
and
I've
added
myself
to
this
coming
go
group
which,
let's
see
oh
yeah,
probably
need
to
run
migrations,
see
ok,.
A
A
Okay,
so
this
is
the
the
profile
page
of
the
of
the
group,
which
is
able
to
make
great
meats,
and
here
we
have
a
four
four
at
the
for
registering
a
meat
and
I
use,
Google
Maps
to
define
the
locations
so
it
that
works
the
same
as
as
meetup,
and
you
see
it's
it's.
It's
added
the
its
embedded,
a
Google
map
and.
A
A
So
this
is,
this:
is
reading
the
bone
right
to
to
the
people
in
back.
So
basically,
this
is
this
is
like
the
the
may.
This
is
the
main.
This
is
the
main
routine
of
the
of
the
application.
So
this
is
what
this
is.
What
getting
walked
the
new
when
you
run
the
application,
and
so
we
basically,
we
basically,
let's
say
initialize
the
the
web
server
here,
and
they
also,
we
also
read
register
the
routes
of
the
old
web
server.
A
A
So,
for
example,
you
see
the
the
block
I've
highlighted,
that's
the
that's
the
route
for
getting
the
the
JavaScript,
so
the
JavaScript
is
served
as
a
bundle
and
this
this
route
it
it
defines
the
route
forgetting
or
forgetting
the
the
bundle
from
the
server.
So
it's
basically
it's
like
a
succession
of
filters.
The
first
filters
work.
Yet
it
basically
says
it's:
it
has
to
be
a
get
requests
and
the
second
the
filter
says
it
has
to
be.
A
A
It
will
also
take
an
instance
of
the
database,
client
or
the
database
objects.
Let's
say,
and
when
that,
when
that
route
is
invoked,
it
will
execute
a
an
API
function
called
a
post,
API,
login
and
I
thought.
We
could
have
a
look
at
that.
So
basically
this
route,
it
implements
the
login
to
the
log
into
the
web,
application
by
the
user
and
if
I
user
logs
in
successfully
the
server
will
respond
with
a
with
an
authentication
cookie
and
that's
also
economy.
A
Interesting
because
wart
does
not
have
support
for
for
authentication
cookies
actually
had
to
do
that
myself.
So
then,
like
I,
don't
I
learned
how
to
make
authentic
authentic
Asian
cookies,
myself,
like
in
past
projects,
I've
just
used
frameworks
to
make
oh
like
cookies,
the
tire
I
could
see
how
to
do
it
and
I
also
also
used
I
used
like
fairly
new
technology
called
Pacita,
which
is
like
an
alternative
alternative
to
JSON
web
tokens
for
a
for
ensure
inch
for.
A
A
A
The
the
first
object
it
takes
is
actually
the
JSON
payload
I
mean
it's
like.
It's
like
the
login
form
sent
via
Jason.
It
gets
that
gets
decoded
into
a
so
called
login
objectives
along
guinness,
it's
a
type
I
defined
and
in
rust,
so
that
basically
matches
the
the
payload
the
serve
the
Defiant's
will
send
with
a
login
and
the
second.
The
second
parameter
is
the
database
object
which
I'll
define
myself
and
you
can
see
I.
B
A
I
actually
use
rust.
Am
I
serious,
like
I,
used
to
think
all
the
physical?
Do
you
plea
it
or
something
and
I'm
not
sure
why
I'm
not
sure
why
it's
failing
when
it's
when
it
I'm,
not
sure
yeah,
oh
yeah,
it's
like
if
it
fails,
it's
very
difficult
to
say
you
know
why
oh
yeah,
but
this
is
also
very
cool.
A
So
basically,
the
the
function
is
rough.
This
enforcing
that
the
function
either
has
to
succeed,
in
which
case
it
will
return
a
reply
or
or
it
has
to
fail,
in
which
case
it
returns
a
rejection.
So
this
is
like
something
which
is
super
cool
in
in
rust
that
basically
the
compiler
for
forces
you
to
have
a
success
pot
or
an
error
path,
and
it's
not
like
you
might
throw
an
exception
like
in
Java.
So
yet,
for
example,
it's
like
errors
are
returned
variants.
A
A
So,
for
those
of
you
not
so
familiar
with
rust
there,
basically,
this
line
is
getting
the
user
corresponding
to
the
logins
username
or
email,
as
the
login
will
either
be
by
username
or
email.
So
we
look
in
the
database
for
a
user
which
is
either
either
has
this
username
or
that
that
email
address
and
then
it's
possible,
the
user
is
not
found.
So
basically,
this
much.
A
A
What
I'm
doing
here
is
a
bit
nasty
like
I'm,
basically
I'm,
basically
crushing
if,
if
the
verification
fails,
but
the
reason
is
that
I
not
yet
figure
out
how
to
return
errors
properly
with
good
work,
it's
like
it's
like
I'm
kind
of
working,
a
time
pressure
and
work
is
very
new.
So
it's
a
bit
difficult
to
figure
out
how
to
do
things
properly.
So
my
thing
is
that
this
is
just
a
prototype,
so
I
don't
care
if
it
crashes
on
theirs.
It's
okay!
If
it's
better
than
spending
a
lot
of
time,
doing
it
perfectly.
C
A
A
The
here
we
actually
here
actually
figured
out
how
to
return
an
error
like
an
age
to
be
errors
like
this
is
like
the
rare
case
that
I
figured
out
how
to
do
it
so
we're
basically
returning
an
HTTP
response
unauthorized
because
the
user
was
not
properly
authenticated,
and
here
we
see
the
case
where
we
could
not
find
the
user,
and
in
that
case
we
do
the
same
thing.
You
really
returned
HTTP
response
which
says
that
it's
unauthorized
requests
and
do
I
have
much
time
left.
A
A
A
Personally,
I
would
actually
prefer
not
using
on
/
M
like
I
would
prefer
to
use
just
write,
sequel
directly,
but
I
could
not
I
kind
of
want
to
do.
You
have
migrations,
like
sequel,
migrations
and
I
could
not
find
like
a
separate
migrations
library
so
as
I
end
up
using
these
basic,
the
mostly
because
it
has
migrations
but
I'm,
already
having
I'm
already
having
some
trouble,
defining
the
queries
via
decent,
so
I
kind
of
want
to
I
want
to
kind
of
switch
soon,
but
but
I
have
to
find
the
time.
So
this
is
basically.
A
This
is
basically
the
database
abstraction
I'm
using
so
it
is,
it
is
a
user
defined
type
and
for
it
to
do
to
make
that
in
rust.
You
used
struct
keyword,
and
this
is
like
an
interesting
feature
of
a
breasts
that
basically,
in
order
to
access
the
the
database
connection
from
several
threads,
you
you
have
to
use
a
mutex
which
is
like
threads
in
synchronization,
primitive
and.
A
It
also
have
and
also
to
be
think,
I
think
in
order
to
pass
the
mutex
arounds.
You
have
to
use
what
is
called
an
a
RC
which
is
like
I,
think
it's
like
atomic
ray
reference
counts
yeah.
So
it's
basically
like
it's
kind
of
like
a
garbage
collected
object.
It's
like!
Basically
you
can.
You
can
make
copies
of
it,
so
you
can
pass
it
around
as
much
as
you
like,
and
then
it
keeps
a
reference
count
and
then,
when
the
count
drops
to
zero,
it
gets
deleted.
A
And
then
we
make
a
query
via
the
the
DSL
API,
so
you're,
basically
like
filtering
records
in
the
table
having
the
same
having
the
same
ID-
and
this
is
like
an
interesting
syntax
like
generic
syntax,
where
you
very
call
the
load
method
with
the
user
as
type
parameters.
You
say
that
you
want.
You
want
a
user
object.
So
back.
Oh.
B
A
That's
beautiful
syntax,
it's
like
basically
the
star
means
you
dereference
the
mutex,
because
I'm
pretty
sure
the
comb
variables
is
actually
a
mutex
type
here,
so
you
have
to
dereference
it
to
get
to
get
like
the
the
connection
contained
by
the
me
or
look
guarded
by
the
mutex
and,
and
they
are
presented,
is
for
making
it
into
a
reference.
So
references
are
like
key
to
memory
management
in
in
interest
like
if,
if
I
did
not
pass
con
as
a
reference,
it
would
mean
that
the
the
receiving
the
receiving
method
would
actually
consume
the
common
object.
A
A
Yeah-
and
you
see
here
this
is
this-
is
basically
an
example
of
of
the
function
being
able
to
return
either
sum
or
non.
So
sum
means
that
you,
if
that's
like
it
means
you
found,
means
that
you
return
something
and
the
non
needs.
Your
yeah
you're,
not
returning
anything
that
basically
corresponds
to
having
null
or
undefined
in
JavaScript,
for
example,
or
a
null
in
C++,
but
in
in
rusty,
avoid
that
by
instead
having
the
option
the
option
in
like
wherever
you
can
return
like
a
null
value,
you'll
return
option.
D
A
B
A
B
B
C
A
A
C
C
A
B
D
B
E
It's
exponentially
grows
and
after
that,
after
some
time,
if
there
is
no
blocking
calls
operating
on
it,
it
the
case
and
who
joins
all
the
threads
back.
So
you
can
use
something
like
that
to
a
couple
of
things.
In
addition
to
your
code
style,
and
maybe
it
would
be
really
good
input,
I
don't
know
there.
Are
people
basically
didn't
work
on
that?
Maybe
there
are
just
new
ways
that
they're
just
going
to
get
in
the
rest.
E
So
first
it's
going
to
be
nice
that
if
everybody
X
how
still
a
match
the
blocks,
so
all
the
matches
should
at
the
end,
if
there
is
no
other
cases,
use
the
exhaustive
match.
So
do
you
see
the
none
in
there?
That
should
be
underscore
in
most
of
the
cases.
This
is
a
good.
How
can
I
say
approach?
Oh
yeah,
and
the
second
thing,
if
you
are
going
to
cast
I
64-bit
to
a
32
for
business
use
from
because
why?
E
Because
you
are
going,
you
might
get
a
most
significant
bit
of
32
might
be
garbage
because
you
are
doing
a
direct
cast
so
I
use
front
rate
which
first
0
eyes
and
then
do
the
converse,
a
commercial
which
is
the
case.
That
is,
in
this
connection,
the
reference
that
you
showed
us
mm-hm
in
there
you
are
casting
the
you
user
ID
from
I-64.
A
B
E
So
this
is
basically
how
it's
going
to
be
really
nice,
because
otherwise,
if
the
the
most
significant
pics
are
basically
wrong
and
then
it's
going
to
be
crash
at
that
point,
yeah
and
then
basically
whole
database
going
to
stall
at
that
point.
Probably
connections
are
also
going
to
leak
because
probably
arc
is
not
going
to
drop.
I
also
think
so.
I
don't
want
to
scare
anyone
anymore,
but
yeah.
This
might
happen
in
some
scenarios.