SlideShare a Scribd company logo
The Rust Programming Language
A gentle introduction
Mario A. Santini
Software Developer
Telco field
What is Rust
●
A language for system programming
●
Created by Mozilla (2010~, 2015 v1.0)
●
Multi paradigm, fast, productive and safe
●
“Fearless concurrency”
●
Community Driven and Open Source (MIT lic.)
Why we need it?
●
A replacement of C/C++ (mostly C++)
●
A powerfull type system
●
Zero cost of abstraction
●
Safety with the borrow checker
●
Highly memory controll without a GC
●
Rustup, cargo, rustfmt...
Where you should use it?
●
System code as alternative of C/C++ or where you
should have bindings with such libs
●
System code as an alternative of Java or Go where you
need more precise control of the memory (no GC)
●
Embedded applications
●
Bar metal
●
WebAssembly and more...
The strenghts?
●
Many concurrency bugs are almost impossible!
●
Strong memory handling checks!
●
Enums first class citizens!
●
Explicit error handling!
●
No NULL, null, nil…!
●
Powerfull Pattern Matching!
●
Macro!
...and more features…
●
Dependency handling included (cargo)
●
Documentation included (/// + rustdoc)
●
Linter included
●
Test/Examples/Bench included
●
RLS (rust-analyzer)...
Data Types
Length Signed Unsigned FP Bool Char
8-bit i8 u8 - true/false -
16-bit i16 u16 - - -
32-bit i32 u32 f32 - ‘ ’😻
64-bit i64 u64 f64 - -
128-bit i128 u128 - - -
arch isize usize - - -
Compund Types
tuple
array
Enum Struct Smart Pointer Raw Pointer Generics Trait
Strings Types
str
String
Ownership Rules
●
Each value in Rust has a variable that’s called its
owner
●
There can only be one owner at a time
●
When the owner goes out of scope, the value
will be dropped
Ownership some examples
let my_var = String::from(“Hello Developer Thursday!”);
require_ownership(my_var); // ← move ownership
println!(“My var {}”, my_var); // ← can’t be done!
…
let another_var = String::from(“Hi Developer Thursday!”);
just_borrow_it(&another_var); // ← notice the &
println!(“Another {}”, another_var); // ← now it’s fine!!
…
let mut mutable_var = String::from(“Hi ”);
requiere_mutable_borrow(&mut mutable_var); // this is possible as Rust guarantee there will
// just 1 reference to mutable_var
println!(“A mutable var {}”, mutable_var);
Lifetime
fn just_a_function<’a>(
haystack: &’a str, needle: &’a str
) → Option<&’a str> {
let found = haystack.find(needle)?;
let result = &haystack[found..needle.len()];
Some(reuslt.as_ref())
}
Ownership and structs
struct MyStruct { … }
impl MyStruct {
fn method_that_borrow(&self, …) { … }
fn method_with_mutable_borrow(&mut self, …) { … }
fn method_that_take_ownership(self, …) { … }
}
Multithreading vs Async
Multithreading → good for parallelization
Async → good for concurrecy
Native OS threads
async / .await
+ runtime
(tokio / async-std)
No Green Thread anymore in the language
But how fast it can be?
ripgrep: https://blog.burntsushi.net/ripgrep/
A closer look...
ripgrep: https://blog.burntsushi.net/ripgrep/
Discord Switching From Go to Rust
https://blog.discordapp.com/why-discord-is-switching-from-go-to-rust-a190bbca2b1f
Rust for the web
Seed: Rust framework for creating fast and reliable web apps with a structure that follows the Elm
Architecture.
Percy: A modular toolkit for building interactive frontend browser apps with Rust + WebAssembly.
Supports server side rendering.
Yew: Rust / Wasm client web app framework with architecture inspired by Elm and Redux. Yew is
based on stdweb that has a lot of features.
Draco: A Rust library for building client side web applications with WebAssembly modeled after the
Elm architecture and Redux.
Smithy: A front-end framework for writing WebAssembly applications entirely in Rust. Its goal is to
allow you to do so using idiomatic Rust, without giving up any of the compiler's safety guarantees.
squark: Rust frontend framework, for web browser and more with architecture inspired from Elm
and HyperApp.
Dodrio: A fast, bump-allocated virtual DOM library for Rust and WebAssembly.
rust-dominator: Zero cost declarative DOM library using FRP signals for Rust!
WASM
It’s a standard from W3C
Run inside the
browsers
Can be written in any
LLVM supported
language
Safe
Open and debuggable
Efficient and fast
It’s not JavaScript
https://webassembly.org/
WASM: Why Rust?
Rust
C/C++
AssemblyScript
TinyGo
Graalvm (just recently)
WASI
The WebAssembly System Interface
March 2019: Standardizing WASI: A system interface to run WebAssembly
outside the web
https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/
C / Rust
It’s a standard as a subgroup of the W3C
WebAssembly CG
https://wasi.dev/
Bytecode Alliance
Wastime
●
A runtime to run WASM + WASI application on the server
●
Written in Rust!
●
Safe as the application is sandboxed as it runs inside a browser
●
Fast as WASM is a compact and efficient format
●
Lightwight as you just need the runtime
●
Portable the format is standard on every architecture, just need the
runtime!
●
Polyglot wastime can be ported to different languages, and so you can
import librearies written in Rust and compiled in WASM and then
loaded as a Python module!
Krustlet
●
A kubelet rewritten in Rust, that runs WASM
programs
●
No need of containers images anymore
●
No need of an OS anymore!
●
And Krustlet can run without any OS too!!
Resources
●
Rust lang official site: https://www.rust-lang.org/
●
Crates.io: https://crates.io/
●
Rustup: https://rustup.rs/
●
Cargo: https://doc.rust-lang.org/cargo/
●
Rust book: https://doc.rust-lang.org/book/
●
Rustonomicon: https://doc.rust-lang.org/nomicon/
●
Rust by examples: https://doc.rust-lang.org/rust-by-example/
●
Rust cheat sheet: https://cheats.rs/
●
Rust users community: https://users.rust-lang.org/
●
Rust youtube channel: https://www.youtube.com/channel/UCaYhcUwRBNscFNUKTjgPFiA
●
Rust github: https://github.com/rust-lang/rust
●
Discord Rust streames channel: https://discord.com/channels/234804991343198210/749624598860922890
●
Rust playground: https://play.rust-lang.org/
●
Discord move to Rust: https://blog.discordapp.com/why-discord-is-switching-from-go-to-rust-a190bbca2b1f
●
WebAssembly: https://webassembly.org/
●
WASI: https://wasi.dev
●
Krustlet: https://github.com/deislabs/krustlet
●
Bytecode Alliance https://bytecodealliance.org/
Thanks!

More Related Content

What's hot

Rust programming-language
Rust programming-languageRust programming-language
Rust programming-language
Mujahid Malik Arain
 
Introduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractionsIntroduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractions
yann_s
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for Everyone
C4Media
 
Rust: Unlocking Systems Programming
Rust: Unlocking Systems ProgrammingRust: Unlocking Systems Programming
Rust: Unlocking Systems Programming
C4Media
 
An introduction to Rust: the modern programming language to develop safe and ...
An introduction to Rust: the modern programming language to develop safe and ...An introduction to Rust: the modern programming language to develop safe and ...
An introduction to Rust: the modern programming language to develop safe and ...
Claudio Capobianco
 
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Codemotion
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
jgrahamc
 
The Rust Programming Language: an Overview
The Rust Programming Language: an OverviewThe Rust Programming Language: an Overview
The Rust Programming Language: an Overview
Roberto Casadei
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricks
GarethHeyes
 
Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016
Aaron Hnatiw
 
Embedded Rust on IoT devices
Embedded Rust on IoT devicesEmbedded Rust on IoT devices
Embedded Rust on IoT devices
Lars Gregori
 
Introduction to Rust
Introduction to RustIntroduction to Rust
Introduction to Rust
Jean Carlo Machado
 
Neat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionNeat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protection
Mikhail Egorov
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventure
mylittleadventure
 
Understanding JWT Exploitation
Understanding JWT ExploitationUnderstanding JWT Exploitation
Understanding JWT Exploitation
AkshaeyBhosale
 
PHP unserialization vulnerabilities: What are we missing?
PHP unserialization vulnerabilities: What are we missing?PHP unserialization vulnerabilities: What are we missing?
PHP unserialization vulnerabilities: What are we missing?
Sam Thomas
 
C++17 std::filesystem - Overview
C++17 std::filesystem - OverviewC++17 std::filesystem - Overview
C++17 std::filesystem - Overview
Bartlomiej Filipek
 
SQLAlchemy Primer
SQLAlchemy PrimerSQLAlchemy Primer
SQLAlchemy Primer
泰 増田
 
gRPC: The Story of Microservices at Square
gRPC: The Story of Microservices at SquaregRPC: The Story of Microservices at Square
gRPC: The Story of Microservices at Square
Apigee | Google Cloud
 

What's hot (20)

Rust programming-language
Rust programming-languageRust programming-language
Rust programming-language
 
Introduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractionsIntroduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractions
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for Everyone
 
Rust: Unlocking Systems Programming
Rust: Unlocking Systems ProgrammingRust: Unlocking Systems Programming
Rust: Unlocking Systems Programming
 
An introduction to Rust: the modern programming language to develop safe and ...
An introduction to Rust: the modern programming language to develop safe and ...An introduction to Rust: the modern programming language to develop safe and ...
An introduction to Rust: the modern programming language to develop safe and ...
 
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
 
The Rust Programming Language: an Overview
The Rust Programming Language: an OverviewThe Rust Programming Language: an Overview
The Rust Programming Language: an Overview
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricks
 
Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016
 
Embedded Rust on IoT devices
Embedded Rust on IoT devicesEmbedded Rust on IoT devices
Embedded Rust on IoT devices
 
Introduction to Rust
Introduction to RustIntroduction to Rust
Introduction to Rust
 
Neat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionNeat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protection
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventure
 
Understanding JWT Exploitation
Understanding JWT ExploitationUnderstanding JWT Exploitation
Understanding JWT Exploitation
 
PHP unserialization vulnerabilities: What are we missing?
PHP unserialization vulnerabilities: What are we missing?PHP unserialization vulnerabilities: What are we missing?
PHP unserialization vulnerabilities: What are we missing?
 
C++17 std::filesystem - Overview
C++17 std::filesystem - OverviewC++17 std::filesystem - Overview
C++17 std::filesystem - Overview
 
SQLAlchemy Primer
SQLAlchemy PrimerSQLAlchemy Primer
SQLAlchemy Primer
 
gRPC: The Story of Microservices at Square
gRPC: The Story of Microservices at SquaregRPC: The Story of Microservices at Square
gRPC: The Story of Microservices at Square
 

Similar to The Rust Programming Language

Rust Hack
Rust HackRust Hack
Rust Hack
Viral Parmar
 
Web Development Environments: Choose the best or go with the rest
Web Development Environments:  Choose the best or go with the restWeb Development Environments:  Choose the best or go with the rest
Web Development Environments: Choose the best or go with the restgeorge.james
 
Legacy of Void*
Legacy of Void*Legacy of Void*
Legacy of Void*Adam Crain
 
Us 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimesUs 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimes
Ravishankar Somasundaram
 
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
apidays
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
Shakacon
 
Introduction to Rust (Presentation).pptx
Introduction to Rust (Presentation).pptxIntroduction to Rust (Presentation).pptx
Introduction to Rust (Presentation).pptx
Knoldus Inc.
 
TypeScript, Dart, CoffeeScript and JavaScript Comparison
TypeScript, Dart, CoffeeScript and JavaScript ComparisonTypeScript, Dart, CoffeeScript and JavaScript Comparison
TypeScript, Dart, CoffeeScript and JavaScript Comparison
Haim Michael
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Aaron Rosenberg
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than You
Robert Cooper
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
Joseph de Castelnau
 
Techtalks: taking docker to production
Techtalks: taking docker to productionTechtalks: taking docker to production
Techtalks: taking docker to production
muayyad alsadi
 
JOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to ProductionJOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to Production
Jordan Open Source Association
 
A Slice Of Rust - A quick look at the Rust programming language
A Slice Of Rust - A quick look at the Rust programming languageA Slice Of Rust - A quick look at the Rust programming language
A Slice Of Rust - A quick look at the Rust programming language
LloydMoore
 
Node.js Course 2 of 2 - Advanced techniques
Node.js Course 2 of 2 - Advanced techniquesNode.js Course 2 of 2 - Advanced techniques
Node.js Course 2 of 2 - Advanced techniques
Manuel Eusebio de Paz Carmona
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
David Padbury
 
Jinx - Malware 2.0
Jinx - Malware 2.0Jinx - Malware 2.0
Jinx - Malware 2.0
Itzik Kotler
 
Web assembly with go
Web assembly with goWeb assembly with go
Web assembly with go
WangChow1
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
Jim Driscoll
 
Raising the Bar on Robotics Code Quality
Raising the Bar on Robotics Code QualityRaising the Bar on Robotics Code Quality
Raising the Bar on Robotics Code Quality
Thomas Moulard
 

Similar to The Rust Programming Language (20)

Rust Hack
Rust HackRust Hack
Rust Hack
 
Web Development Environments: Choose the best or go with the rest
Web Development Environments:  Choose the best or go with the restWeb Development Environments:  Choose the best or go with the rest
Web Development Environments: Choose the best or go with the rest
 
Legacy of Void*
Legacy of Void*Legacy of Void*
Legacy of Void*
 
Us 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimesUs 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimes
 
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
Introduction to Rust (Presentation).pptx
Introduction to Rust (Presentation).pptxIntroduction to Rust (Presentation).pptx
Introduction to Rust (Presentation).pptx
 
TypeScript, Dart, CoffeeScript and JavaScript Comparison
TypeScript, Dart, CoffeeScript and JavaScript ComparisonTypeScript, Dart, CoffeeScript and JavaScript Comparison
TypeScript, Dart, CoffeeScript and JavaScript Comparison
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than You
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Techtalks: taking docker to production
Techtalks: taking docker to productionTechtalks: taking docker to production
Techtalks: taking docker to production
 
JOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to ProductionJOSA TechTalk: Taking Docker to Production
JOSA TechTalk: Taking Docker to Production
 
A Slice Of Rust - A quick look at the Rust programming language
A Slice Of Rust - A quick look at the Rust programming languageA Slice Of Rust - A quick look at the Rust programming language
A Slice Of Rust - A quick look at the Rust programming language
 
Node.js Course 2 of 2 - Advanced techniques
Node.js Course 2 of 2 - Advanced techniquesNode.js Course 2 of 2 - Advanced techniques
Node.js Course 2 of 2 - Advanced techniques
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
Jinx - Malware 2.0
Jinx - Malware 2.0Jinx - Malware 2.0
Jinx - Malware 2.0
 
Web assembly with go
Web assembly with goWeb assembly with go
Web assembly with go
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
 
Raising the Bar on Robotics Code Quality
Raising the Bar on Robotics Code QualityRaising the Bar on Robotics Code Quality
Raising the Bar on Robotics Code Quality
 

More from Mario Alexandro Santini

A Safe Dock for our Programs
A Safe Dock for our ProgramsA Safe Dock for our Programs
A Safe Dock for our Programs
Mario Alexandro Santini
 
Rust With async / .await
Rust With async / .awaitRust With async / .await
Rust With async / .await
Mario Alexandro Santini
 
Rust_Threads.pdf
Rust_Threads.pdfRust_Threads.pdf
Rust_Threads.pdf
Mario Alexandro Santini
 
The_Borrow_Checker.pdf
The_Borrow_Checker.pdfThe_Borrow_Checker.pdf
The_Borrow_Checker.pdf
Mario Alexandro Santini
 
Vuejs
VuejsVuejs
Introduction to typescript
Introduction to typescriptIntroduction to typescript
Introduction to typescript
Mario Alexandro Santini
 
The myth of the small script
The myth of the small scriptThe myth of the small script
The myth of the small script
Mario Alexandro Santini
 
Docker jug taa
Docker   jug taaDocker   jug taa
Docker jug taa
Mario Alexandro Santini
 
Lambda architecture
Lambda architectureLambda architecture
Lambda architecture
Mario Alexandro Santini
 

More from Mario Alexandro Santini (9)

A Safe Dock for our Programs
A Safe Dock for our ProgramsA Safe Dock for our Programs
A Safe Dock for our Programs
 
Rust With async / .await
Rust With async / .awaitRust With async / .await
Rust With async / .await
 
Rust_Threads.pdf
Rust_Threads.pdfRust_Threads.pdf
Rust_Threads.pdf
 
The_Borrow_Checker.pdf
The_Borrow_Checker.pdfThe_Borrow_Checker.pdf
The_Borrow_Checker.pdf
 
Vuejs
VuejsVuejs
Vuejs
 
Introduction to typescript
Introduction to typescriptIntroduction to typescript
Introduction to typescript
 
The myth of the small script
The myth of the small scriptThe myth of the small script
The myth of the small script
 
Docker jug taa
Docker   jug taaDocker   jug taa
Docker jug taa
 
Lambda architecture
Lambda architectureLambda architecture
Lambda architecture
 

Recently uploaded

Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 

Recently uploaded (20)

Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 

The Rust Programming Language

  • 1. The Rust Programming Language A gentle introduction
  • 2. Mario A. Santini Software Developer Telco field
  • 3. What is Rust ● A language for system programming ● Created by Mozilla (2010~, 2015 v1.0) ● Multi paradigm, fast, productive and safe ● “Fearless concurrency” ● Community Driven and Open Source (MIT lic.)
  • 4. Why we need it? ● A replacement of C/C++ (mostly C++) ● A powerfull type system ● Zero cost of abstraction ● Safety with the borrow checker ● Highly memory controll without a GC ● Rustup, cargo, rustfmt...
  • 5. Where you should use it? ● System code as alternative of C/C++ or where you should have bindings with such libs ● System code as an alternative of Java or Go where you need more precise control of the memory (no GC) ● Embedded applications ● Bar metal ● WebAssembly and more...
  • 6. The strenghts? ● Many concurrency bugs are almost impossible! ● Strong memory handling checks! ● Enums first class citizens! ● Explicit error handling! ● No NULL, null, nil…! ● Powerfull Pattern Matching! ● Macro!
  • 7. ...and more features… ● Dependency handling included (cargo) ● Documentation included (/// + rustdoc) ● Linter included ● Test/Examples/Bench included ● RLS (rust-analyzer)...
  • 8. Data Types Length Signed Unsigned FP Bool Char 8-bit i8 u8 - true/false - 16-bit i16 u16 - - - 32-bit i32 u32 f32 - ‘ ’😻 64-bit i64 u64 f64 - - 128-bit i128 u128 - - - arch isize usize - - - Compund Types tuple array Enum Struct Smart Pointer Raw Pointer Generics Trait Strings Types str String
  • 9. Ownership Rules ● Each value in Rust has a variable that’s called its owner ● There can only be one owner at a time ● When the owner goes out of scope, the value will be dropped
  • 10. Ownership some examples let my_var = String::from(“Hello Developer Thursday!”); require_ownership(my_var); // ← move ownership println!(“My var {}”, my_var); // ← can’t be done! … let another_var = String::from(“Hi Developer Thursday!”); just_borrow_it(&another_var); // ← notice the & println!(“Another {}”, another_var); // ← now it’s fine!! … let mut mutable_var = String::from(“Hi ”); requiere_mutable_borrow(&mut mutable_var); // this is possible as Rust guarantee there will // just 1 reference to mutable_var println!(“A mutable var {}”, mutable_var);
  • 11. Lifetime fn just_a_function<’a>( haystack: &’a str, needle: &’a str ) → Option<&’a str> { let found = haystack.find(needle)?; let result = &haystack[found..needle.len()]; Some(reuslt.as_ref()) }
  • 12. Ownership and structs struct MyStruct { … } impl MyStruct { fn method_that_borrow(&self, …) { … } fn method_with_mutable_borrow(&mut self, …) { … } fn method_that_take_ownership(self, …) { … } }
  • 13. Multithreading vs Async Multithreading → good for parallelization Async → good for concurrecy Native OS threads async / .await + runtime (tokio / async-std) No Green Thread anymore in the language
  • 14. But how fast it can be? ripgrep: https://blog.burntsushi.net/ripgrep/
  • 15. A closer look... ripgrep: https://blog.burntsushi.net/ripgrep/
  • 16. Discord Switching From Go to Rust https://blog.discordapp.com/why-discord-is-switching-from-go-to-rust-a190bbca2b1f
  • 17. Rust for the web Seed: Rust framework for creating fast and reliable web apps with a structure that follows the Elm Architecture. Percy: A modular toolkit for building interactive frontend browser apps with Rust + WebAssembly. Supports server side rendering. Yew: Rust / Wasm client web app framework with architecture inspired by Elm and Redux. Yew is based on stdweb that has a lot of features. Draco: A Rust library for building client side web applications with WebAssembly modeled after the Elm architecture and Redux. Smithy: A front-end framework for writing WebAssembly applications entirely in Rust. Its goal is to allow you to do so using idiomatic Rust, without giving up any of the compiler's safety guarantees. squark: Rust frontend framework, for web browser and more with architecture inspired from Elm and HyperApp. Dodrio: A fast, bump-allocated virtual DOM library for Rust and WebAssembly. rust-dominator: Zero cost declarative DOM library using FRP signals for Rust!
  • 18. WASM It’s a standard from W3C Run inside the browsers Can be written in any LLVM supported language Safe Open and debuggable Efficient and fast It’s not JavaScript https://webassembly.org/
  • 20. WASI The WebAssembly System Interface March 2019: Standardizing WASI: A system interface to run WebAssembly outside the web https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ C / Rust It’s a standard as a subgroup of the W3C WebAssembly CG https://wasi.dev/
  • 22. Wastime ● A runtime to run WASM + WASI application on the server ● Written in Rust! ● Safe as the application is sandboxed as it runs inside a browser ● Fast as WASM is a compact and efficient format ● Lightwight as you just need the runtime ● Portable the format is standard on every architecture, just need the runtime! ● Polyglot wastime can be ported to different languages, and so you can import librearies written in Rust and compiled in WASM and then loaded as a Python module!
  • 23. Krustlet ● A kubelet rewritten in Rust, that runs WASM programs ● No need of containers images anymore ● No need of an OS anymore! ● And Krustlet can run without any OS too!!
  • 24. Resources ● Rust lang official site: https://www.rust-lang.org/ ● Crates.io: https://crates.io/ ● Rustup: https://rustup.rs/ ● Cargo: https://doc.rust-lang.org/cargo/ ● Rust book: https://doc.rust-lang.org/book/ ● Rustonomicon: https://doc.rust-lang.org/nomicon/ ● Rust by examples: https://doc.rust-lang.org/rust-by-example/ ● Rust cheat sheet: https://cheats.rs/ ● Rust users community: https://users.rust-lang.org/ ● Rust youtube channel: https://www.youtube.com/channel/UCaYhcUwRBNscFNUKTjgPFiA ● Rust github: https://github.com/rust-lang/rust ● Discord Rust streames channel: https://discord.com/channels/234804991343198210/749624598860922890 ● Rust playground: https://play.rust-lang.org/ ● Discord move to Rust: https://blog.discordapp.com/why-discord-is-switching-from-go-to-rust-a190bbca2b1f ● WebAssembly: https://webassembly.org/ ● WASI: https://wasi.dev ● Krustlet: https://github.com/deislabs/krustlet ● Bytecode Alliance https://bytecodealliance.org/