Return to Video

Josh Matthews - An Introduction To Rust

  • 3:16 - 3:18
    --People are not important --
  • 3:19 - 3:23
    --There are no people in technology,
    just replaceable components --
  • 3:23 - 3:28
    (Laughter)
  • 6:16 - 6:17
    Alright let's do this.
  • 6:21 - 6:26
    Alright, I'm going to tell
    you about what Rust is,
  • 6:26 - 6:29
    why Rust is a part of Mozilla's work
  • 6:29 - 6:32
    and when it's going to start
    being a part of Mozilla's work.
  • 6:33 - 6:33
    Let's begin.
  • 6:34 - 6:36
    So Rust is a new programming language
  • 6:36 - 6:40
    that has been created inside Mozilla
  • 6:41 - 6:42
    and shared with the outside world.
  • 6:43 - 6:45
    The goal of it
  • 6:45 - 6:46
    is basically
  • 6:46 - 6:49
    anytime when you traditionally
  • 6:49 - 6:50
    as a developer have
  • 6:51 - 6:52
    reached for C++
  • 6:52 - 6:55
    because you needed certain guarantees
    about performance for example
  • 6:55 - 6:57
    we want Rust to be a viable alternative
  • 6:57 - 6:58
    in every single case.
  • 6:58 - 7:01
    There should be no reason to choose C++
  • 7:01 - 7:02
    over Rust
  • 7:03 - 7:04
    in the ideal future.
  • 7:07 - 7:09
    So it began as a side project
  • 7:09 - 7:11
    of a Mozillian named Graydon Hoare
  • 7:11 - 7:14
    back in before 2009.
  • 7:14 - 7:16
    He started working on it full-time
  • 7:16 - 7:18
    in 2009
  • 7:18 - 7:21
    because Mozilla saw the
    ideas that he had and said
  • 7:21 - 7:23
    "We can see how we
    could put this into Firefox...
  • 7:23 - 7:26
    ...and make the product better
    if we actually had this language".
  • 7:26 - 7:30
    So that's when we started investing
    time and resources into it.
  • 7:32 - 7:33
    Fast forward a few years
  • 7:33 - 7:37
    we now have a team under
    the Mozilla Research umbrella
  • 7:37 - 7:39
    who's working full-time
    on improving the language
  • 7:40 - 7:44
    and we released
    version 1.0 last year
  • 7:44 - 7:47
    and every 6 weeks we
    now release a new version
  • 7:47 - 7:48
    so we just released 1.13
  • 7:49 - 7:51
    and there is a large community
  • 7:51 - 7:53
    around the language now
  • 7:54 - 7:56
    so not only do we have developers
  • 7:56 - 7:57
    working in Mozilla on it
  • 7:58 - 8:01
    some of those developers are part
    of what's called the Core Team
  • 8:01 - 8:03
    and those are the people that
    decide the future of the language
  • 8:03 - 8:06
    and help shape where
    it's going as time goes on
  • 8:07 - 8:08
    so in addition to our employees
  • 8:08 - 8:09
    we have volunteers
  • 8:09 - 8:11
    and employees from other companies
  • 8:11 - 8:15
    that are now depending on
    Rust for their products
  • 8:15 - 8:17
    and they're helping shape this ecosystem
  • 8:17 - 8:21
    which then has a large number of libraries
  • 8:21 - 8:24
    that are being developed by people
  • 8:24 - 8:25
    who are enthusiastic about the language
  • 8:25 - 8:29
    it's got a lot of downloads happening
    since the last time I gave this talk
  • 8:29 - 8:32
    there've been 10 million more downloads
    and 300 new libraries published
  • 8:32 - 8:35
    so there's a lot going on,
    there's also the friends of Rust
  • 8:35 - 8:38
    which I'll show you
  • 8:38 - 8:43
    there is a page showing lots of different
    companies that've told us
  • 8:43 - 8:45
    "Yes, we are relying on
    Rust in production...
  • 8:45 - 8:49
    ...we are very excited
    about its prospects".
  • 8:50 - 8:52
    So, lots of cool things going on there.
  • 8:58 - 9:01
    So the reason for Rust
  • 9:01 - 9:04
    is that we have in the past
  • 9:04 - 9:07
    what 10 or more years of using Firefox
  • 9:07 - 9:08
    and Javascript in Firefox
  • 9:08 - 9:10
    sorry C++ and Javascript in Firefox
  • 9:10 - 9:12
    we've come across the fact that
  • 9:13 - 9:15
    there are some pervasive problems
  • 9:16 - 9:18
    that are caused by using C++
  • 9:19 - 9:23
    that is writing code that
    makes use of local threads
  • 9:23 - 9:24
    is very difficult
  • 9:24 - 9:26
    it's easy to write incorrect code
  • 9:26 - 9:30
    and it is very easy to write
    code which is unsafe
  • 9:30 - 9:31
    and that translates into
  • 9:31 - 9:33
    security exploits
  • 9:33 - 9:36
    things that are stored by governments
  • 9:36 - 9:37
    and by hackers
  • 9:37 - 9:38
    all over the world
  • 9:38 - 9:39
    and used to
  • 9:40 - 9:41
    steal data from users
  • 9:41 - 9:43
    and take over their computers
  • 9:43 - 9:44
    using the browser as a vector.
  • 9:44 - 9:48
    There's a huge number of these
    that are released every year
  • 9:48 - 9:52
    by security investigators
  • 9:52 - 9:54
    and there's competitions showing
  • 9:54 - 9:57
    who can pwn a browser the quickest.
  • 9:58 - 10:02
    So we looked for ways to address this
  • 10:02 - 10:03
    by creating a new language
  • 10:03 - 10:04
    and it turns out
  • 10:04 - 10:06
    that actually both of these issues
  • 10:06 - 10:08
    make it difficult to write parallel code
  • 10:08 - 10:10
    that makes use of modern hardware
  • 10:11 - 10:14
    and writing code that is
    safe and not exploitable
  • 10:14 - 10:15
    turns out they can both be addressed
  • 10:15 - 10:18
    by introducing the concept of
    Ownership in the language.
  • 10:18 - 10:21
    So let's talk about what that means.
  • 10:21 - 10:24
    Ownership encapsulates two ideas basically
  • 10:25 - 10:28
    it is what the owner of a value is
  • 10:28 - 10:30
    and whether there are
    multiple owners of a value
  • 10:30 - 10:34
    or mulitple users that are sharing a value
  • 10:34 - 10:38
    and additionally when that
    value is actually valid.
  • 10:38 - 10:41
    What is the point in the program
  • 10:41 - 10:44
    in which it's actually safe
    to interact with the value.
  • 10:45 - 10:47
    And so from this we can derive a few rules
  • 10:48 - 10:50
    that if there is only a
    single owner for a value
  • 10:50 - 10:54
    that value can be destroyed
    when the owner goes out of scope
  • 10:54 - 10:57
    because there are no ways to
    reference that value anymore
  • 10:58 - 11:00
    similarly if a value
    has only a single owner
  • 11:00 - 11:02
    that means that it is legal to mutate it
  • 11:02 - 11:06
    because no one can observe
    the change to that value
  • 11:06 - 11:07
    and finally
  • 11:08 - 11:10
    if you have multiple owners
  • 11:10 - 11:11
    you need to have
  • 11:11 - 11:12
    something called Borrowing
  • 11:12 - 11:14
    which is, you still have a single owner
  • 11:14 - 11:15
    but other people can observe it
  • 11:15 - 11:18
    but it cant be changed during that time.
  • 11:18 - 11:21
    So let's talk about an analogy here,
  • 11:22 - 11:24
    if I've got a colouring book and a marker
  • 11:24 - 11:25
    and some friends
  • 11:25 - 11:27
    we can establish some rules
  • 11:28 - 11:31
    the colouring book and
    the marker are my property
  • 11:31 - 11:33
    so they go with me wherever I go
  • 11:33 - 11:35
    if I leave no one else can
    observe the book
  • 11:35 - 11:36
    or colour in it
  • 11:37 - 11:41
    however I am able to loan
    the book to someone else
  • 11:41 - 11:43
    and that means they're
    borrowing it from me
  • 11:43 - 11:45
    that also means that I can't colour
    in it while they're borrowing it
  • 11:45 - 11:46
    because that's rude
  • 11:47 - 11:49
    so they can also choose to
    lend it to people around them
  • 11:50 - 11:53
    but that means that if
    anyone else is borrowing it
  • 11:53 - 11:55
    they need to give it back
    to me before they leave
  • 11:55 - 11:56
    because it's my property
  • 11:56 - 11:58
    and only I can leave with it.
  • 12:00 - 12:00
    Additionally,
  • 12:03 - 12:04
    if I have the marker
  • 12:04 - 12:05
    I'm able to colour in the book
  • 12:05 - 12:06
    if I have the book
  • 12:07 - 12:09
    I can also give the marker to someone else
  • 12:09 - 12:12
    and that means they can colour
    in the book if they have it
  • 12:12 - 12:14
    but that means that I'm
    no longer able to colour
  • 12:14 - 12:16
    because there's only a single marker.
  • 12:16 - 12:17
    And finally,
  • 12:17 - 12:20
    if I want to leave but I dont actually
    have the book in my posession
  • 12:20 - 12:25
    there's a problem, either I need to wait
    until someone gives me the book back
  • 12:25 - 12:27
    or I need to actually give
    it to someone else and say
  • 12:27 - 12:30
    "OK, it's not my property anymore,
    ...it's yours to deal with".
  • 12:32 - 12:34
    So Ownership in Rust.
  • 12:37 - 12:41
    If we have a type we call a ColouringBook
  • 12:41 - 12:42
    and it gives us a constructor
  • 12:42 - 12:44
    that returns a new instance
    of a ColouringBook.
  • 12:44 - 12:45
    We can say OK,
  • 12:45 - 12:48
    here is a variable called a Book
  • 12:48 - 12:50
    which we will say
  • 12:50 - 12:52
    stores this ColouringBook value.
  • 12:52 - 12:53
    That means that we can now
  • 12:53 - 12:54
    call this Colour method
  • 12:54 - 12:57
    which will change the
    Colouring Book in some way,
  • 12:57 - 12:58
    it'll colour in it.
  • 12:58 - 13:00
    That's fine, we can mutate it
  • 13:00 - 13:01
    because we only have a single owner.
  • 13:04 - 13:05
    So what happens if
  • 13:05 - 13:07
    someone borrows the Book?
  • 13:07 - 13:09
    We now have another variable
    called Borrowed Book
  • 13:09 - 13:11
    and we use the ampersand
  • 13:11 - 13:13
    to show that we are borrowing the value
  • 13:13 - 13:16
    that's stored in this value called Book
  • 13:16 - 13:17
    - this variable called Book.
  • 13:17 - 13:19
    This is an Immutable Borrow.
  • 13:20 - 13:23
    That means that it is not possible
  • 13:23 - 13:25
    to mutate the original value anymore
  • 13:25 - 13:27
    because it's borrowed.
  • 13:27 - 13:28
    So we cannot colour in the book
  • 13:28 - 13:30
    while it's borrowed by someone else.
  • 13:31 - 13:33
    This follows our analogy.
  • 13:34 - 13:35
    The other thing however
  • 13:35 - 13:38
    is that if someone else is
    borrowing the book,
  • 13:38 - 13:39
    they also cannot colour in it.
  • 13:39 - 13:40
    They don't have the marker.
  • 13:40 - 13:45
    In this case they only have
    an Mutable Borrow
  • 13:45 - 13:46
    so they cannot mutate it.
  • 13:49 - 13:51
    So we can work around this
  • 13:51 - 13:53
    by using what's called a Mutable Borrow.
  • 13:53 - 13:54
    This says OK,
  • 13:54 - 13:55
    give me the book and
    give me the marker
  • 13:56 - 13:59
    and then they have both those elements
  • 13:59 - 14:01
    necessary in order
    to actually colour in it
  • 14:01 - 14:03
    and mutate it in this case.
  • 14:03 - 14:04
    So we have the ampersand
  • 14:04 - 14:06
    followed by the Mute keyword
  • 14:06 - 14:06
    and this means
  • 14:06 - 14:09
    give me a Mutable Borrow
  • 14:09 - 14:10
    to the value that follows.
  • 14:13 - 14:15
    However the thing to note here
  • 14:15 - 14:19
    is that we cannot use
    the original variable
  • 14:19 - 14:20
    called Book
  • 14:20 - 14:22
    in order to mutate it while it's borrowed.
  • 14:22 - 14:24
    We cannot have two different
    people colouring in it
  • 14:24 - 14:26
    because only one person
    can colour at a time.
  • 14:30 - 14:32
    So let's go back to the
    example we had before.
  • 14:33 - 14:34
    So we've got a Book value
  • 14:34 - 14:36
    we're allowed to colour in it
  • 14:36 - 14:37
    because there's no one borrowing it
  • 14:37 - 14:38
    then on the next line
  • 14:38 - 14:40
    we have an Immutable Borrow
  • 14:41 - 14:43
    and we're not allowed to colour
  • 14:43 - 14:44
    in the original one again
  • 14:44 - 14:45
    this is fine
  • 14:45 - 14:46
    it's borrowed
  • 14:46 - 14:47
    it can't be coloured in.
  • 14:48 - 14:49
    So let's fix this
  • 14:50 - 14:53
    this is where we talk about lifetimes
  • 14:53 - 14:54
    because remember how I said that
  • 14:54 - 14:57
    we can figure out
    when a value is valid?
  • 14:57 - 14:59
    So this means that if we have a scope here
  • 14:59 - 15:01
    deliniated by
  • 15:01 - 15:03
    the curly braces
  • 15:03 - 15:06
    this means that inside the curly braces
  • 15:06 - 15:08
    anything that is unique inside there
  • 15:08 - 15:10
    no longer exists outside of them.
  • 15:10 - 15:12
    So if we create this Borrowed Book value
  • 15:12 - 15:15
    and we borrow from the Book value
  • 15:15 - 15:17
    we have a Mutable Borrow
  • 15:17 - 15:18
    and that's fine
  • 15:18 - 15:20
    we can then do something with this
  • 15:20 - 15:21
    that doesn't require mutating it
  • 15:21 - 15:24
    we can just look through the
    Book, we can investigate it,
  • 15:24 - 15:26
    and that doesn't mutate it, that's fine.
  • 15:26 - 15:30
    And so previously calling Colour
    on the original Book value
  • 15:30 - 15:31
    would've been an error
  • 15:31 - 15:32
    because it was borrowed
  • 15:32 - 15:34
    but now the borrow no longer exists
  • 15:34 - 15:37
    because it is only valid within
    the scope of these braces.
  • 15:37 - 15:39
    This is how we can control
  • 15:39 - 15:41
    the scope of a Borrow.
  • 15:43 - 15:46
    So finally we can also transfer Ownership.
  • 15:46 - 15:49
    This is how we talk about giving
    away the Book to someone else.
  • 15:49 - 15:51
    By default we can say OK,
  • 15:52 - 15:54
    we'll create a new variable called Book 2
  • 15:54 - 15:57
    and it will have the contents
    of the Book variable
  • 15:58 - 15:59
    and we can now colour in Book 2.
  • 15:59 - 16:02
    That's fine, it's not a borrow
    there's no ampersand there
  • 16:02 - 16:04
    we are giving control of the value
  • 16:04 - 16:05
    to another variable
  • 16:07 - 16:08
    and additionally
  • 16:08 - 16:10
    if you try to compile this
    you'll note that
  • 16:10 - 16:13
    we can no longer interact
    with the Book variable
  • 16:13 - 16:15
    because we transfered Ownership
  • 16:15 - 16:16
    it doesn't exist anymore
  • 16:16 - 16:18
    the compiler knows this and can say
  • 16:18 - 16:20
    "Nope, that is not safe
    what you're trying to do".
  • 16:22 - 16:25
    And you'll note the link up here
    actually goes to a playground
  • 16:25 - 16:28
    where you can play with the
    Rust compiler in your browser
  • 16:28 - 16:32
    and there's a sample for this code
    that you can experiment with there
  • 16:32 - 16:33
    already prepared for you.
  • 16:36 - 16:36
    So
  • 16:37 - 16:39
    we understand Borrowing
    a little bit better now
  • 16:39 - 16:41
    especially with the analogy
  • 16:41 - 16:43
    but how does this
    actually help in practice?
  • 16:43 - 16:46
    How does this address the two
    cases we talked about before?
  • 16:46 - 16:48
    Using values after they're no longer valid
  • 16:49 - 16:56
    and writing code that works with
    multiple threads at the same time.
  • 16:57 - 16:57
    So first
  • 16:58 - 17:01
    with Use-after-free problems
  • 17:02 - 17:05
    those happen in C++
  • 17:05 - 17:08
    because you'll have pointers in your code
  • 17:08 - 17:09
    but the pointers are not associated
  • 17:09 - 17:11
    with the value they're pointing to.
  • 17:11 - 17:13
    So you could delete
  • 17:13 - 17:15
    the memory that they're pointing to
  • 17:15 - 17:17
    but the pointers are still
    pointing at that memory
  • 17:17 - 17:20
    and so if you aren't careful
    you can end up using pointers
  • 17:20 - 17:21
    that are pointing to invalid memory.
  • 17:21 - 17:22
    So in Rust
  • 17:22 - 17:24
    the compiler is actually tracking this
  • 17:25 - 17:27
    so it doesn't let you write code
  • 17:27 - 17:28
    that has the potential
  • 17:29 - 17:32
    where pointers could point at
    memory that no longer is valid
  • 17:33 - 17:34
    and that means that
  • 17:34 - 17:37
    you're always taking
    borrowed pointers to values
  • 17:38 - 17:39
    where the compiler says
  • 17:39 - 17:41
    "OK. I know exactly how
    long this value is valid for...
  • 17:41 - 17:45
    ...because I know what the owner
    is and therefore any pointers to it...
  • 17:45 - 17:51
    ...must no longer exist before
    the owner no longer exists"
  • 17:54 - 17:55
    and additionally
  • 17:55 - 17:56
    you can also
  • 17:56 - 18:00
    because the Rust compiler also
    tracks outstanding Borrows
  • 18:00 - 18:01
    you can also say
  • 18:01 - 18:05
    "OK, we are guaranteed that
    there's no way to mutate this...
  • 18:05 - 18:08
    ...while anyone else is borrowing
    and trying to look at the value"
  • 18:08 - 18:10
    and this addresses another case
  • 18:10 - 18:12
    where this can happen in C++
  • 18:12 - 18:15
    where you end up changing the value
  • 18:15 - 18:19
    like reallocating a pointer or something
    while other things are trying to point to
  • 18:19 - 18:20
    memory that it was relying on
  • 18:21 - 18:24
    and as for parallel code
    with multiple threads
  • 18:25 - 18:27
    the issue arises with Data Races
  • 18:27 - 18:29
    where you have multiple threads
  • 18:29 - 18:32
    that are sharing values and
    they're also mutating them.
  • 18:32 - 18:34
    It's the same issue we
    just talked about basically
  • 18:34 - 18:37
    where they're not
    coordinated in figuring out
  • 18:37 - 18:40
    when it's safe to write to a value and
    when it's safe to read from a value
  • 18:40 - 18:42
    because you might get intermediate values
  • 18:42 - 18:44
    when the write hasn't completed yet.
  • 18:44 - 18:50
    So Rust addresses this by forcing you
    to either transfer ownership of values
  • 18:50 - 18:51
    that another thread needs to use
  • 18:51 - 18:54
    so that two threads cannot
    share the same value
  • 18:54 - 18:55
    or
  • 18:55 - 18:58
    ensuring that any values that you
    do share between the threads
  • 18:58 - 18:59
    abide by certain restrictions
  • 18:59 - 19:02
    that prevent invalid writes from happening
  • 19:02 - 19:04
    and invalid reads from happening
  • 19:04 - 19:05
    so that races can't happen
  • 19:05 - 19:11
    and it's impossible to write code that
    is not actually thread safe.
  • 19:13 - 19:14
    So
  • 19:14 - 19:15
    how this actually applies
  • 19:15 - 19:17
    to what we're doing at Mozilla
  • 19:17 - 19:20
    is that we've got the Mozilla
    Research organisation
  • 19:20 - 19:23
    and so part of them are working
    on improving Rust the language.
  • 19:23 - 19:25
    However another part of them
  • 19:25 - 19:27
    are working on building a
    brand new web browser
  • 19:27 - 19:29
    because Firefox is not enough.
  • 19:29 - 19:31
    This one's called Servo
  • 19:31 - 19:33
    and so we're building it
    from the ground up
  • 19:33 - 19:35
    and the reason we're doing this is that
  • 19:35 - 19:37
    there are decisions that were made
  • 19:37 - 19:39
    design decisions for Firefox
  • 19:39 - 19:40
    that were made a decade ago
  • 19:40 - 19:44
    which are very difficult to
    change at this point in time
  • 19:44 - 19:46
    it'd be a huge amount of work
  • 19:46 - 19:48
    to redesign parts of Firefox
    we think could be better
  • 19:48 - 19:50
    but it's also difficult
  • 19:50 - 19:53
    to verify whether that would be
  • 19:53 - 19:56
    a worthwhile use of time
    without actually doing it
  • 19:56 - 19:58
    so we compromise by creating
    a brand new browser
  • 19:58 - 20:00
    where we can actually try out new ideas
  • 20:00 - 20:03
    and give ourselves a playground
    to experiment with things
  • 20:03 - 20:05
    we could do better in Firefox
    and if they work out great
  • 20:05 - 20:10
    we can then start transferring them
    back into Firefox and integrate them
  • 20:10 - 20:11
    and additionally
  • 20:11 - 20:13
    this means that we can experiment
  • 20:13 - 20:17
    with letting out pages
  • 20:17 - 20:18
    doing that in parallel
  • 20:18 - 20:21
    rather than all other browsers today
  • 20:21 - 20:23
    which do them sequentially
    and single-thread
  • 20:23 - 20:24
    we can do things
  • 20:24 - 20:26
    like experiment with the way
  • 20:26 - 20:27
    that we
  • 20:27 - 20:28
    redraw things to the screen
  • 20:28 - 20:30
    and do it more like a computer game
  • 20:31 - 20:33
    we can do things like change the way
  • 20:33 - 20:36
    that we're managing memory
  • 20:36 - 20:38
    for the parts of the web page
  • 20:38 - 20:40
    so that it's more integrated
    with the garbage collection
  • 20:40 - 20:42
    that the Javascript code
  • 20:42 - 20:44
    ends up ineracting with
  • 20:44 - 20:46
    so all of this are things
    that we're doing in Servo
  • 20:46 - 20:48
    and we're getting some great results
  • 20:48 - 20:50
    and some of them are already
  • 20:50 - 20:52
    being integrated back into Firefox.
  • 20:53 - 20:56
    So we're already shipping foot code today
  • 20:56 - 20:57
    in Firefox that's written in Rust.
  • 20:58 - 21:00
    For example we have parts
    of our Media Stack where
  • 21:00 - 21:07
    we have code that's just responsible
    for reading parts of video files
  • 21:07 - 21:09
    which has been a source of security
    vulnerabilities in the past
  • 21:09 - 21:12
    and there's no reason
    that should be the case
  • 21:12 - 21:13
    so we rewrite it in Rust
  • 21:13 - 21:15
    and we get safety by default.
  • 21:15 - 21:17
    So that's shipping in Firefox today.
  • 21:17 - 21:19
    We've also got a project called Oxidation
  • 21:19 - 21:21
    which is a list on the wiki
  • 21:21 - 21:24
    of all the pieces that
    we're in the process
  • 21:24 - 21:27
    of writing in Rust in Firefox today
  • 21:28 - 21:29
    some of the most challenging ones
  • 21:29 - 21:30
    that I mentioned previously
  • 21:30 - 21:32
    the Rendering Engine
  • 21:32 - 21:35
    the Style System and Layout
  • 21:35 - 21:37
    those are being integrated
    into Firefox today
  • 21:37 - 21:39
    as part of the Quantum Project
  • 21:39 - 21:41
    and so you can basically expect that
  • 21:41 - 21:43
    the amount of Rust code in Firefox
  • 21:43 - 21:44
    will increase over time
  • 21:44 - 21:47
    there's been a lot of really good
    results panning out so far
  • 21:48 - 21:50
    especially for areas where
  • 21:50 - 21:52
    they shouldn't be security sensitive
  • 21:52 - 21:55
    that they need to be high performance
  • 21:55 - 21:57
    those could be great places
  • 21:57 - 21:58
    for integrating Rust code
  • 21:58 - 22:01
    because you've got those by default
  • 22:04 - 22:06
    so if you'd like to know more about Rust
  • 22:06 - 22:07
    and Mozilla
  • 22:07 - 22:09
    you can check out the Rust
    Playground I mentioned earlier
  • 22:09 - 22:12
    that allows you to experiment
    with writing Rust code
  • 22:12 - 22:13
    in your browser
  • 22:13 - 22:15
    we've got a nice introductory book
  • 22:15 - 22:18
    that covers everything you need
    to know about the language
  • 22:18 - 22:19
    called The Rust Programming Language
  • 22:19 - 22:23
    which is accessible from the language
    website and we've got IRC channels
  • 22:23 - 22:27
    which are designed for both beginners
    who like to interact with other people
  • 22:27 - 22:30
    who really want to answer
    your questions right there
  • 22:30 - 22:32
    as well as a huge community
    in the Rust channel
  • 22:32 - 22:35
    who really adore asking
    and answering questions.
  • 22:37 - 22:38
    That's all.
  • 22:38 - 22:39
    Thank you very much.
  • 22:40 - 22:42
    [Applause]
  • 22:42 - 22:43
    Any questions?
  • 22:49 - 22:50
    Yes
  • 22:53 - 22:56
    What would be a good way to
    start contributing or participating?
  • 22:57 - 22:59
    There's a few ways
  • 22:59 - 23:02
    so if there are
  • 23:05 - 23:06
    let me see
  • 23:06 - 23:09
    if there are libraries that you
    would like to use from Rust
  • 23:09 - 23:10
    that don't exist yet
  • 23:11 - 23:14
    writing either libraries
    from scratch in Rust
  • 23:14 - 23:16
    to scratch that itch
  • 23:16 - 23:17
    very handy
  • 23:17 - 23:18
    publishing that for the community
  • 23:18 - 23:22
    or if there are libraries
    written in C which already exist
  • 23:22 - 23:25
    which would give you functionality
    but don't exist in Rust yet
  • 23:25 - 23:27
    then writing bindings in Rust
  • 23:27 - 23:30
    around a C library
  • 23:30 - 23:32
    is very useful
  • 23:33 - 23:36
    because that allows you to
    build safer abstractions
  • 23:36 - 23:38
    on top of things that would
    otherwise be potentially unsafe
  • 23:38 - 23:41
    but is really easy to
    integrate with C code
  • 23:41 - 23:45
    which is one reason why it's working
    out so well to integrate Rust in Firefox.
  • 23:47 - 23:49
    There's lots of other suggestions
    on the Rust website
  • 23:49 - 23:52
    of ways to participate in
    the Rust Community
  • 23:53 - 23:55
    if that's what you're asking.
  • 23:58 - 23:59
    Yes Lucy?
  • 24:16 - 24:19
    What are the most compelling
    reasons for someone to learn
  • 24:19 - 24:25
    the language and potentially start
    participating and contributing?
  • 24:27 - 24:29
    One thing I've heard
    is that actually people
  • 24:29 - 24:32
    who don't already have what's called
  • 24:32 - 24:34
    systems programming experience
  • 24:34 - 24:37
    so a lot of experience
    using C++ for example
  • 24:37 - 24:39
    one of the lower level languages
  • 24:39 - 24:41
    people coming from a web
    development background
  • 24:41 - 24:44
    people writing a lot of
    Javascript, Ruby, Python
  • 24:45 - 24:48
    what I've heard is that people
    coming from those languages
  • 24:48 - 24:51
    are actually getting
    their first experience
  • 24:51 - 24:53
    doing low level programming stuff
  • 24:54 - 24:58
    but in a way which is much less daunting
  • 24:58 - 24:59
    than C or C++
  • 24:59 - 25:03
    where they know that the
    compiler has their back
  • 25:03 - 25:06
    in ways that the compilers
    for C++, for example, don't
  • 25:06 - 25:08
    and it will tell you when
    you're making mistakes
  • 25:08 - 25:10
    and it won't let you make those mistakes
  • 25:10 - 25:11
    which is pretty exciting.
  • 25:15 - 25:18
    There are two people who I know
  • 25:18 - 25:20
    who come from Ruby
  • 25:20 - 25:21
    Javascript backgrounds
  • 25:21 - 25:23
    who are now putting together
  • 25:24 - 25:25
    a series of tutorials
  • 25:25 - 25:28
    for teaching people how to do
    kernel programming using Rust
  • 25:30 - 25:32
    with the intention that other
    people are coming from those
  • 25:32 - 25:34
    high level backgrounds
  • 25:34 - 25:36
    and trying this out for the first time
  • 25:36 - 25:40
    so there's a lot of ways to experiment
    with things that traditionally has been
  • 25:40 - 25:41
    rather unapproachable
  • 25:41 - 25:44
    for large segments of the
    developer population.
  • 25:50 - 25:52
    Pretty compelling reason really
  • 25:52 - 25:55
    and even if you do have
    experience doing C++
  • 25:55 - 25:57
    and lower level things like that
  • 25:59 - 26:02
    I find that not having to worry
    about whole classes of problems
  • 26:02 - 26:03
    you can make
  • 26:03 - 26:06
    as a developer in those languages
  • 26:06 - 26:08
    makes a huge difference
  • 26:08 - 26:10
    it allows you to reason
    about your code better
  • 26:10 - 26:14
    it allows you to be more
    adventurous with your code.
  • 26:15 - 26:35
    (Inaudible audience discussion)
  • 26:40 - 26:41
    So the questions was
  • 26:42 - 26:44
    one of the things people have talked about
  • 26:45 - 26:50
    is that Rust should be able to make
    the process of refactoring your code
  • 26:50 - 26:54
    easier, safer, generally less complicated
  • 26:54 - 26:56
    and less uncertain
  • 26:56 - 26:58
    and has there been talk of that
  • 26:58 - 27:00
    has there been evidence of that
  • 27:00 - 27:01
    and yes
  • 27:01 - 27:03
    there's actually a really great blog post
  • 27:03 - 27:04
    in the past couple weeks
  • 27:04 - 27:06
    of someone who was
  • 27:06 - 27:08
    refactoring their code
  • 27:08 - 27:12
    and the compiler kept pointing out
    ways in which it would not be safe
  • 27:12 - 27:14
    to refactor it in that certain way
  • 27:14 - 27:16
    because it was shared between threads
  • 27:17 - 27:19
    like he would fix that thing
  • 27:19 - 27:21
    and it would go down the
    rabbit hole a little bit further
  • 27:21 - 27:23
    and say "Oh now this isn't safe anymore".
  • 27:23 - 27:26
    and was this very compiler
    guided refactoring session
  • 27:26 - 27:27
    which he wrote about
  • 27:28 - 27:30
    and documented top to bottom
  • 27:30 - 27:32
    and it's great, it seems to just
  • 27:32 - 27:33
    verify the premise
  • 27:33 - 27:37
    that this does prevent you
    from making mistakes.
  • 27:43 - 27:45
    Alright let's call it there.
  • 27:45 - 27:47
    Thank you for attending everybody
  • 27:47 - 27:50
    [Applause]
Title:
Josh Matthews - An Introduction To Rust
Description:

more » « less
Video Language:
English
Duration:
28:19

English subtitles

Revisions