The Rust Programming Language and Free Software Development at Scale

Chris Nixon

Created: 2017-01-27

Rust the Language

 "Rust is as close to the bare metal as you can get."
--paperelectron
  • Systems Programming Language from Mozilla
  • Aims for the trifecta: Fast, Safe and Concurrent.
  • Free Software (Dual Licenced MIT and Apache2)

Fast

<ketralnis> Rust is also really phobic of heap allocations […]
<Xion>      Yes, Rust encourages everyone to be a full stack developer :)
  • Explicit control over memory
  • No GC overhead
  • Zero Cost Abstractions
  • Built on top of llvm

Safe

"Rust is like a big bucket of solder and wire, with the promise
 that you can't electrocute yourself."

--frankmcsherry
  • Memory safe without GC
  • No Nulls!
  • No mutable aliasing
  • Automatic bounds checking

Concurrent

"Rust is like doing parkour while suspended on strings & wearing
 protective gear. Yes, it will sometimes look a little ridiculous,
 but you'll be able to do all sorts of cool moves without hurting
 yourself."
--Ilogiq
  • Threading without Data Races
  • Safety without copying
  • Async IO with Futures/Tokio

Other Awesome Features

  • Local Type inference
  • Immutable by default
  • Unicode Strings
  • Sum Types
  • Exhaustive pattern matching
  • Trait based Generics
  • Modern Module system
  • No Runtime
  • Compiles to WebAssembly
  • Hygenic AST based Macros
  • Compiler Plugins

Unsafe blocks

"Opening a vortex to Hell is actually safe, but de-referencing
 anything you pull from the vortex isn't safe."

--Steve Klabnik
  • Access/Update static mutable variables
  • Dereference a raw pointer
  • Call other unsafe code

Examples

Hello World

fn main() {
    println!("hello, world");
}

Variables

fn main() {
    let one = 1u32;
    let mut three = 0;
    three = one + 2;
    print_number(three);
}

Types

struct Point(i32, i32);

enum Shape{
    Circle{centre: Point},
    Rectangle{top_left: Point, bottom_right: Point},
}

Match

fn main() {
    let obj = Shape::Rectangle{top_left: Point(0,0),
                               bottom_right: Point(0, 0)};
    match obj {
        Shape::Circle{centre: Point(x, y)} => {
            println!("It's a circle centred at {},{}", x, y)
        },
        Shape::Rectangle{top_left: _, bottom_right: _} => {
            println!("It's a rectangle, somewhere...")
        },
        _ => println!("It's something else, wait, what?"),
    }
}

Loads more, but they've not given me enough time!

Rust the Ecosystem

Rustc

"Diagnostics are the UX of a compiler, and so they're deserving of the
 exact same care that is put into mobile app or Web design."

--pcwalton
  • Written in Rust
  • Backed by llvm

Rustup

  • Toolchain manager
  • Rustc
  • Cargo
  • Docs
  • Rustc/stdlib Sources

Cargo

"The Rust standard libs aren't quite batteries included, but they come
 with a pile of adaptor cables and an optional chemistry lab."
--Gankro
  • Modern Dependency manager
  • Build Tool
  • Cross compilation
  • Static compilation

Crates.io

< durka42  > rust has a culture of small crates
< XMPPwocky> a Cargo cult, if you will
  • Central package repository
  • Thousands of packages
  • Mandatory SemVer

Rustfmt

  • Idea Blatantly stolen from Go
  • Standardised format for all code

Rust the Free Software Project?

The Present

Rustc is one of the largest Projects on Github

  • ~61000 commits
  • ~1700 unique contributors
  • ~20000 issues (~3000 open)
  • ~20000 PRs (~100 open)
  • ~7500 Crates on crates.io
  • 6 weekly release train

The Past

  • Personal Project (2006-2010)
  • Adopted by Mozilla (2010)
  • RFC Process Introduced (2014)
  • 1.0 (May 2015)

The Future

Servo

"There is essentially no webpage out there that it cannot get
 through at multiple hundreds of frames-per-second"

-- pcwalton
  • Free Software, on Github
  • Next Generation browser engine
  • Exploit Parallelism
  • Aggressively offload to the GPU

Language Teams

  • Core Team
  • Language Design Team
  • Compiler Team
  • Library Team
  • Tooling and Infra
  • Docs Team
  • Community Team
  • Moderation Team
  • Strike Teams

Submitting Code/Docs

  • Submit a PR
  • Make sure it builds and passes tests!
  • Get it reviewed
  • Tweak until Approved

RFC Process

  • Create an RFC with your feature idea
  • Summary, Motivation, Detailed Design, How do we teach this?, Drawbacks, Alternatives, Unresolved Questions
  • Get it reviewed
  • Tweak until Approved

Automation

Rust's Most prolific Contributors (The Bots)

  • Highfive
  • Bors/Homu

Continuous integration

  • Every PR built and tested
  • All Supported Operating Systems
  • All Supported Architectures

Community

Some fun Projects

  • Redox
  • Piston
  • Vulkano
  • Iron
  • Hyper
  • Ring
  • librsvg
  • Corrode

How to Get Started

Looking to Contribute?

Summary

Rust is a massive step forward in the state of the art. Go use it.