Let's play with rust! a friendly introduction

Mehul Patel,@rowdymehul

*

Some slides Reference : @f_jimenez

Let's introduce each other

my name is _ and I am fro_.

I am at #Mozfest and it feels _.

I like the language because of _.

About me

  • I am Mehul Patel
  • Engineer at Zimbra
  • moz://a
  • Reps Mentor, CAC
  • Auth0 Ambassador
  • Rust Mobilizer
  • Blogger

Let's do a small activity together

WHAT
WHY
HOW

where are we with Rust?

2017-18

Rust is the Most Loved Language by Developers

friends of rust

Organizations running Rust in production.

(https://www.rust-lang.org/en-US/friends.html)

WHAT

System programming language that has great control like C/C++, delivers productivity like in Python and is super safe

Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.

Graydon Hoare's personal project started in 2005

-

Sponsored (not owned) by Mozilla since 2009

-

Rust 1.0 since May 2015

-

Current stable version 1.29.2

-

6 weeks release cycle

COMMUNITY

WHY

Must be this tall to write multi-threaded code

Why should one consider Rust?

  • State of art programming language

  • Solves a lot of common system programming bugs

  • Cargo: Rust Package manager

  • Improving your toolkit

  • Self-learning

  • It's FUN ...

the reason that I’ve looked into Rust at first.

  • Rust is new enough that you can write useful stuff that would have already existed in other languages

  • It gives a relatively familiar tool to the modern C++ developers, but in the much more consistent and reliable ways.

  • It is low-level enough that you take account of most resources.

  • It's more like C++ and Go, less like Node and Ruby

  • cargo is awesome. Managing crates just works as intended, which makes a whole lot of troubles you may have in other languages just vanish with a satisfying poof.

own definition: Rust

Rust is a good choice when you’d choose C++. You can also say, “Rust is a systems programming language that pursuing the trifecta: safe, concurrent, and fast.” I would say, Rust is an ownership-oriented programming language.

Just follow these rules perfectly,

you’re smart.

C/C++

Inspired by @qedunham

Wait a minute,

I’ll take care of it.

Java and others

Hack without fear!

Rust

Speed
Safety
PARALELLISM

Choose all three!

Zero-cost abstractions

-

Memory safety without garbage collector

-

Threads without data races

OWNERSHIP and Borrowing

Ownership

Mutable borrow

Immutable borrow

fn f(x: Type) {...}
fn f(x: &mut Type) {...}
fn f(x: &Type) {...}
  • Total control
  • read-write
  • one at a time
  • read-write
  • Share as you like
  • read-only

Inspired by Jeena Lee and @lastontheboat 

HOW

ONLINE

RUSTUP

curl https://sh.rustup.rs -sSf | sh

Features of rustup tool

-> Update to latest version:

rustup update stable

-> Update the rustup tool to the latest version

rustup self update

-> Install the nightly toolkit version of the Rust compiler:

rustup install nightly

-> Change the default version of the Rust compiler to nightly version:

rustup default nightly

CARGO

TESTING

pub fn add_two(a: i32) -> i32 {
    a + 2
}
#[test]
fn it_works() {
    assert_eq!(add_two(2), 4);
}

IDE

RUSTLANG NURSERY

COMMUNITY CHANNELS

Users discourse forum

Internals discourse forum

r/rust on Reddit

Rust StackOverflow tag

#rust-beginners

LEARN

THANK YOU!

RustIN_MozFest18

By Mehul Patel

RustIN_MozFest18

This is the basic session of Rust Programming. #rusthacks #rustlang

  • 1,335