rust baksia2014

24
Introducing the Rust programming language Reidar Sollid Functional concurrent oriented low level language

Upload: reidar-sollid

Post on 20-Jun-2015

275 views

Category:

Technology


4 download

DESCRIPTION

Rust lang introduction for the Baksia meetup

TRANSCRIPT

Page 1: Rust baksia2014

Introducing the Rust programming languageReidar Sollid

Functional concurrent oriented low level language

Page 2: Rust baksia2014

2 Presentation Title - Classification

So what is Rust

• A programming language from Mozilla labs •

• Compiled un-managed language• Ahead of time compiler• Concurrent-oriented

• – Message passing– Default immutable variables (mutable keyword)

• • Lambda expressions with a lot if easy to use code• Classes and traits• No NPE crashes, libs use Option<T> or Result<T,U>

• Shared memory is not allowed (Go and Scala does)

Page 3: Rust baksia2014

3 Presentation Title - Classification

What problem to solve

Page 4: Rust baksia2014

4 Presentation Title - Classification

Multiple tabs with websockets

Page 5: Rust baksia2014

5 Presentation Title - Classification

And this

Page 6: Rust baksia2014

6 Presentation Title - Classification

Shared memory model

Shared memory

Processthread

Processthread

Processthread

Page 7: Rust baksia2014

7 Presentation Title - Classification

Message passing

Processthread

Processthread

Processthread

Page 8: Rust baksia2014

8 Presentation Title - Classification

Concurrency and shared memory model

Page 9: Rust baksia2014

9 Presentation Title - Classification

Tasks

Page 10: Rust baksia2014

10 Presentation Title - Classification

Task management

• An Rust program consists of a tree of tasks, with their own stack and sole ownership of allocated heap data

• Communicate through ports and channels

• Propagates failures to its parent (the task spawned this one) unless unsupervise function is called.

• May be executed in parallel and are scheduled by the runtime

• Has its own GC (No global ”stop the world to clean up”)

Page 11: Rust baksia2014

11 Presentation Title - Classification

Hello world

Page 12: Rust baksia2014

12 Presentation Title - Classification

Pattern matching

Page 13: Rust baksia2014

13 Presentation Title - Classification

Pattern matching example

Page 14: Rust baksia2014

14 Presentation Title - Classification

Closures

Page 15: Rust baksia2014

15 Presentation Title - Classification

Closures example

Page 16: Rust baksia2014

16 Presentation Title - Classification

Ports and Channels Task commuication

Page 17: Rust baksia2014

17 Presentation Title - Classification

Port and channel example

Page 18: Rust baksia2014

18 Presentation Title - Classification

Pointers

Page 19: Rust baksia2014

19 Presentation Title - Classification

Pointers example

Page 20: Rust baksia2014

20 Presentation Title - Classification

Class construct

Page 21: Rust baksia2014

21 Presentation Title - Classification

Some high order functions

Page 22: Rust baksia2014

22 Presentation Title - Classification

Unit test example

Page 23: Rust baksia2014

23 Presentation Title - Classification

Crate examples

Page 24: Rust baksia2014

24 Presentation Title - Classification

Stickers ?