Skip to content

Instantly share code, notes, and snippets.

@cristianrasch
Created October 29, 2015 19:13
Show Gist options
  • Save cristianrasch/c1ed980dc4f6b19bf21e to your computer and use it in GitHub Desktop.
Save cristianrasch/c1ed980dc4f6b19bf21e to your computer and use it in GitHub Desktop.
Why Rust?

Introduction

  • Systems programming language (safety & control)
  • Stack (default) vs. heap allocated vars
  • Statically typed, although the type inference is pretty sweet
  • Statement and expression based langguage
  • Features structs, enums and traits
  • Static (favored) & dynamic method dispatch
  • Has generics & type bounds
  • Small language, well documentated stdlib
  • Code organization: creates & modules
  • Cargo is the project build & dep mgmt tool
  • crates.io is where third-party libs live

Prgramming paradigms

Safety first!

  • Automatic memory mgmt w/o a garbage collector (mem is freed for u)
  • No use-after-free or undefined behavior problems
  • Aliasing + mutation is not allowed (N &T or exactly 1 &mut T)
  • Ownership & borrowing model (static, compile time analysis)
  • The compiler enforces the data moves (ownership is retured back up the stack)

Ease of use

Concurrency

  • No data races b/c the same ownership/borrowing mechanism is used
  • Channels (ownership is 1st transferred to the channel itself)

Digging deeper

Community

  • #rust on irc.mozilla.org
  • @rustlang on Twitter
  • This Week in Rust (weekly newsletter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment