Rust baksia2014

Preview:

DESCRIPTION

Rust lang introduction for the Baksia meetup

Citation preview

Introducing the Rust programming languageReidar Sollid

Functional concurrent oriented low level language

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)

3 Presentation Title - Classification

What problem to solve

4 Presentation Title - Classification

Multiple tabs with websockets

5 Presentation Title - Classification

And this

6 Presentation Title - Classification

Shared memory model

Shared memory

Processthread

Processthread

Processthread

7 Presentation Title - Classification

Message passing

Processthread

Processthread

Processthread

8 Presentation Title - Classification

Concurrency and shared memory model

9 Presentation Title - Classification

Tasks

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”)

11 Presentation Title - Classification

Hello world

12 Presentation Title - Classification

Pattern matching

13 Presentation Title - Classification

Pattern matching example

14 Presentation Title - Classification

Closures

15 Presentation Title - Classification

Closures example

16 Presentation Title - Classification

Ports and Channels Task commuication

17 Presentation Title - Classification

Port and channel example

18 Presentation Title - Classification

Pointers

19 Presentation Title - Classification

Pointers example

20 Presentation Title - Classification

Class construct

21 Presentation Title - Classification

Some high order functions

22 Presentation Title - Classification

Unit test example

23 Presentation Title - Classification

Crate examples

24 Presentation Title - Classification

Stickers ?

Recommended