rustv2
TRANSCRIPT
![Page 1: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/1.jpg)
RUST
@nfmelendez
Nicolás Meléndez
![Page 2: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/2.jpg)
Mozilla sponsor since 2009
Using it for Servo. Mozilla’s browser engine in development.
Rust language v1.1
@nfmelendez
![Page 3: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/3.jpg)
RUST is systems programming language that combines low-level control with high-level convenience and safety guarantees.
Rust language v1.1
@nfmelendez
![Page 4: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/4.jpg)
Safety: prevent mutating, no aliasing, and no race conditions.
Control: over performance, deterministic destruction, no GC.
Convinience: Able to express your model.
Rust language v1.1
@nfmelendez
![Page 5: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/5.jpg)
Rust language v1.1
@nfmelendez
-Rust says: I give you control andSafety but if you follow somerules
![Page 6: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/6.jpg)
Rust language v1.1
@nfmelendez
-Rust says: I give you control andSafety but if you follow someRules-Dev: I accept your rules only ifyou tell me at compile time.
![Page 7: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/7.jpg)
Rust language v1.1
@nfmelendez
-Rust says: I give you control andSafety but if you follow someRules-Dev: I accept your rules only ifyou tell me at compile time. -Rust says: Ok. Deal.
![Page 8: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/8.jpg)
Rust language v1.1
@nfmelendez
You get this to break the rules. Very useful for…. (next talk).
![Page 9: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/9.jpg)
Rust language v1.1
@nfmelendez
1- Memory control & safety (no GC)
2- Data-race freedom (avoid concurrency bugs)
3- Lack of substantial runtime (easy to embed)
benefits
Enforcement of ownership and borrowing
![Page 10: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/10.jpg)
Rust language v1.1
@nfmelendez
Ownership
Example O01
![Page 11: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/11.jpg)
Rust language v1.1
@nfmelendez
Shared Borrow (&T)
Aliasing | mutable
![Page 12: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/12.jpg)
Rust language v1.1
@nfmelendez
Mutable Borrow (&mut)
Aliasing | mutable
![Page 13: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/13.jpg)
Rust language v1.1
@nfmelendez
1- You can borrow inmutable references many times (example B01)
2- You cannot borrow more than one mutable reference. Only one. example B012
3- Cannot exist a mutable reference and an inmutable one simultaneously
Borrowing rules
![Page 14: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/14.jpg)
Rust language v1.1
@nfmelendez
Data Race
Aliasing Mutation No ordening
![Page 15: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/15.jpg)
Rust language v1.1
@nfmelendez
Data Race
Aliasing (Actors) Mutation (Inmutation functional)
No ordening(Mutex)
![Page 16: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/16.jpg)
Rust language v1.1
@nfmelendez
ConcurrencyModel
Avoid Aliasing using ownership model only. (example C01)
Avoid mutation, using inmutable enforcement and Arc<T> references counters. (example C02)
Avoid no ordening, using mutex.
![Page 17: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/17.jpg)
Rust language v1.1
@nfmelendez
Tooling
Sublime text with rust package downloaded.
Cargo dependecy system + building
Debug. Only lldb? No UI or better?
![Page 18: Rustv2](https://reader035.vdocument.in/reader035/viewer/2022062320/55d23655bb61eb42358b47f7/html5/thumbnails/18.jpg)
Rust language v1.1
@nfmelendez
GRACIAS
Examples in : https://github.com/nfmelendez/rust-talk-examples