SlideShare a Scribd company logo
Rust Tutorial | Rust Programming Language Tutorial For Beginners | Rust Training | Edureka
Agenda
Why learn Rust? What is Rust? Rust Fundamentals
01 02 03
RUST
Why learn Rust?
Why Rust?
Cargo packet managerConcurrency
Memory safety
Zero cost abstraction
Rust Stats
What is Rust?
Zero cost abstraction Efficient C binding
Ensures memory safety Pattern matching
Error messages
Threads without data
races
Rust is a safe, concurrent, systems programming language developed by a Mozilla
employee, Graydon Hoare in 2006.
Install Rust On Linux
Rust Fundamentals
Variables
Memory location
Variable name
Variable is a name given to a memory location which acts as a container for storing data.
Syntax:
1 let mut age=15;
2 age=16;
Constants
Constants are fixed values that do not change during execution time.
Syntax:
1
2
const x: f32 = 1.54;
Examples of constants
Scalar Data Types
Character
Boolean
TRUE
FALSE
Integer
Floating-point
12.34 y
Compound Data Types - Arrays
An array is a data structure that contains a list of elements. These elements are all of the
same data type, such as an integer or string.
Syntax:
1
2
let arr=[ ];
0 1 2 3 4 5 6
Compound Data Types - Tuple
A tuple is a data structure that contains a list of elements. These elements can be of
different data type, such as an integer or string.
Syntax:
1
2
let tup: (i32, f64, u8) =
(200, 1.2, 2);
0 1 2 3 4
Strings
A string is basically an array of characters.
Syntax:
1
2
let mut s =
String::new( );
E D U R E K A
0
1
2
3
4
5
6
Functions
A function is a block of organized, reusable code that is used to perform a single, related action.
Functions
Predefined
Functions
User Defined
Functions
Syntax:
1
2
3
fn greetings( ) {
println!(“Hello everyone!”);
}
name of the function
enter parameters here
Conditional Statements - If
Conditional statement is a set of rules performed if a certain condition is met. It is like an
‘If-Then’ statement. (IF a condition is met, THEN an action is performed)
If code
End
Start
True
Condition
False
Exit
Syntax:
1
2
3
if(condition) {
statement;
}
Conditional Statements – If else
Conditional statement is a set of rules performed if a certain condition is met. It is like an
‘If-Then’ statement. (IF a condition is met, THEN an action is performed)
If code
End
Start
True
Condition
False
Else if code
Syntax:
1
2
3
4
5
6
if(condition) {
statement a;
}
else {
statement b;
}
Conditional Statements – Else if
Conditional statement is a set of rules performed if a certain condition is met. It is like an
‘If-Then’ statement. (IF a condition is met, THEN an action is performed)
If code
End
Start
True
Condition
False
Else if code
Syntax:
1
2
3
4
5
6
7
8
9
if(condition) {
statement a;
}
else if(condition) {
statement b;
}
else {
statement c;
}
Loop
Loop is used to repeat a specific block until some end condition is met.
Start
Conditional Code
Condition
False
True
End loop
Syntax:
1
2
3
loop {
statements;
}
For Loop
Repeatedly executes the loop code while a given condition is TRUE. It
tests the condition before executing the loop body.
Start
Execute Statement (s)
End
Next item from
sequence
If no more itemsItem from
sequenceSyntax:
1
2
3
4
for var in expression
{
block statements;
}
While Loop
While the condition is true, the code within the loop is executed.
Start
Conditional Code
End
True
False
Condition
Syntax:
1
2
3
while(condition) {
loop code;
}
Ownership
When a block of code owns a resource, it is known as ownership.
• Every value has a variable associated which is the
owner
• There can only be one owner at a time
• If the owner goes out of scope, the value associated
with it is destroyed
RULES
Example:
1
2
let x=12;
let y=x;
Structure
A structure is a user-defined data type that consists of variables of
different data types.
Syntax:
1
2
3
4
5
struct Student
{
variable: data-type;
variable: data-type;
}
Name
Age
Father’s name
Enum
Enum is a custom data type which contains some definite values.
Syntax:
1
2
3
4
5
enum enum_name
{
variant1,
variant2,
}
Stop
Ready
Go
Traffic
Signal
Modules
A module is a namespace which contains the definitions of the functions
or its types. A module is a collection of items such as functions, traits,
structs, blocks.
Syntax:
1
2
3
mod module_name {
module body
}
• mod - declares the new module
• pub - makes the visibility modifier as public &
accessible outside the namespace
• use - to import the module into local scope
Keywords used in modules:
Vectors
Vectors allow you to store more than one value in a single data structure
that puts all the values next to each other in memory.
Syntax:
1
2
let v : Vec<i32> =
Vec::new( );
• Stores values of the same data type
• It is denoted by Vec<T>
• It is a growable array
Key points of Vectors:
Rust Tutorial | Rust Programming Language Tutorial For Beginners | Rust Training | Edureka
Ad

Recommended

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
 
Introduce to Rust-A Powerful System Language
Introduce to Rust-A Powerful System Language
Anchi Liu
 
Why rust?
Why rust?
Mats Kindahl
 
Go Lang Tutorial
Go Lang Tutorial
Wei-Ning Huang
 
Développement d'un site web jee de e commerce basé sur spring (m.youssfi)
Développement d'un site web jee de e commerce basé sur spring (m.youssfi)
ENSET, Université Hassan II Casablanca
 
Introduction to Rust
Introduction to Rust
Jean Carlo Machado
 
Rust vs C++
Rust vs C++
corehard_by
 
spring-api-rest.pdf
spring-api-rest.pdf
Jaouad Assabbour
 
Python/Flask Presentation
Python/Flask Presentation
Parag Mujumdar
 
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Codemotion
 
Rust
Rust
Chih-Hsuan Kuo
 
Rust Programming Language
Rust Programming Language
Jaeju Kim
 
Pwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreak
Abraham Aranguren
 
Write microservice in golang
Write microservice in golang
Bo-Yi Wu
 
Static typing vs dynamic typing languages
Static typing vs dynamic typing languages
Jawad Khan
 
gRPC Overview
gRPC Overview
Varun Talwar
 
Flask
Flask
Mamta Kumari
 
Frans Rosén Keynote at BSides Ahmedabad
Frans Rosén Keynote at BSides Ahmedabad
Security BSides Ahmedabad
 
Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
Spring Security
Spring Security
Sumit Gole
 
File operations in c
File operations in c
baabtra.com - No. 1 supplier of quality freshers
 
Pentesting like a grandmaster BSides London 2013
Pentesting like a grandmaster BSides London 2013
Abraham Aranguren
 
Introduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring Security
Bruno Henrique Rother
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)
Olve Maudal
 
Architecture jee principe de inversion de controle et injection des dependances
Architecture jee principe de inversion de controle et injection des dependances
ENSET, Université Hassan II Casablanca
 
TypeScript Best Practices
TypeScript Best Practices
felixbillon
 
HTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versions
neexemil
 
File handling in Python
File handling in Python
Megha V
 
Rustlabs Quick Start
Rustlabs Quick Start
sangam biradar
 
Rustbridge
Rustbridge
kent marete
 

More Related Content

What's hot (20)

Python/Flask Presentation
Python/Flask Presentation
Parag Mujumdar
 
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Codemotion
 
Rust
Rust
Chih-Hsuan Kuo
 
Rust Programming Language
Rust Programming Language
Jaeju Kim
 
Pwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreak
Abraham Aranguren
 
Write microservice in golang
Write microservice in golang
Bo-Yi Wu
 
Static typing vs dynamic typing languages
Static typing vs dynamic typing languages
Jawad Khan
 
gRPC Overview
gRPC Overview
Varun Talwar
 
Flask
Flask
Mamta Kumari
 
Frans Rosén Keynote at BSides Ahmedabad
Frans Rosén Keynote at BSides Ahmedabad
Security BSides Ahmedabad
 
Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
Spring Security
Spring Security
Sumit Gole
 
File operations in c
File operations in c
baabtra.com - No. 1 supplier of quality freshers
 
Pentesting like a grandmaster BSides London 2013
Pentesting like a grandmaster BSides London 2013
Abraham Aranguren
 
Introduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring Security
Bruno Henrique Rother
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)
Olve Maudal
 
Architecture jee principe de inversion de controle et injection des dependances
Architecture jee principe de inversion de controle et injection des dependances
ENSET, Université Hassan II Casablanca
 
TypeScript Best Practices
TypeScript Best Practices
felixbillon
 
HTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versions
neexemil
 
File handling in Python
File handling in Python
Megha V
 
Python/Flask Presentation
Python/Flask Presentation
Parag Mujumdar
 
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Codemotion
 
Rust Programming Language
Rust Programming Language
Jaeju Kim
 
Pwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreak
Abraham Aranguren
 
Write microservice in golang
Write microservice in golang
Bo-Yi Wu
 
Static typing vs dynamic typing languages
Static typing vs dynamic typing languages
Jawad Khan
 
Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
Spring Security
Spring Security
Sumit Gole
 
Pentesting like a grandmaster BSides London 2013
Pentesting like a grandmaster BSides London 2013
Abraham Aranguren
 
Introduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring Security
Bruno Henrique Rother
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)
Olve Maudal
 
Architecture jee principe de inversion de controle et injection des dependances
Architecture jee principe de inversion de controle et injection des dependances
ENSET, Université Hassan II Casablanca
 
TypeScript Best Practices
TypeScript Best Practices
felixbillon
 
HTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versions
neexemil
 
File handling in Python
File handling in Python
Megha V
 

Similar to Rust Tutorial | Rust Programming Language Tutorial For Beginners | Rust Training | Edureka (20)

Rustlabs Quick Start
Rustlabs Quick Start
sangam biradar
 
Rustbridge
Rustbridge
kent marete
 
Short intro to the Rust language
Short intro to the Rust language
Gines Espada
 
The Rust Programming Language: an Overview
The Rust Programming Language: an Overview
Roberto Casadei
 
MozillaPH Rust Hack & Learn Session 2
MozillaPH Rust Hack & Learn Session 2
Robert 'Bob' Reyes
 
Introduction to clojure
Introduction to clojure
Abbas Raza
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
Edureka!
 
The Rust Programming Language, Second Edition Steve Klabnik
The Rust Programming Language, Second Edition Steve Klabnik
killrnleiffi
 
Basics of Programming.pptx
Basics of Programming.pptx
SoumitraChakraborty28
 
c & c++ logic building concepts practice.pptx
c & c++ logic building concepts practice.pptx
rawatsatish0327
 
The Rust Programming Language Steve Klabnik
The Rust Programming Language Steve Klabnik
nmiriorola
 
The Rust Programming Language Steve Klabnik
The Rust Programming Language Steve Klabnik
willynnekane42
 
Opject orianted programming in c++ for beg
Opject orianted programming in c++ for beg
engahmedeg94
 
JavaScript: Core Part
JavaScript: Core Part
維佋 唐
 
Sugar Presentation - YULHackers March 2009
Sugar Presentation - YULHackers March 2009
spierre
 
The Rust Programming Language 2nd Edition Steve Klabnik
The Rust Programming Language 2nd Edition Steve Klabnik
onutaithakut25
 
Download Complete The Rust Programming Language 2nd Edition Steve Klabnik PDF...
Download Complete The Rust Programming Language 2nd Edition Steve Klabnik PDF...
maggannawsad
 
The Rust Programming Language 2nd Edition Second Converted Steve Klabnik Caro...
The Rust Programming Language 2nd Edition Second Converted Steve Klabnik Caro...
cizekchingbj
 
Software fundamentals
Software fundamentals
Susan Winters
 
Rust concurrency tutorial 2015 12-02
Rust concurrency tutorial 2015 12-02
nikomatsakis
 
Short intro to the Rust language
Short intro to the Rust language
Gines Espada
 
The Rust Programming Language: an Overview
The Rust Programming Language: an Overview
Roberto Casadei
 
MozillaPH Rust Hack & Learn Session 2
MozillaPH Rust Hack & Learn Session 2
Robert 'Bob' Reyes
 
Introduction to clojure
Introduction to clojure
Abbas Raza
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
Edureka!
 
The Rust Programming Language, Second Edition Steve Klabnik
The Rust Programming Language, Second Edition Steve Klabnik
killrnleiffi
 
c & c++ logic building concepts practice.pptx
c & c++ logic building concepts practice.pptx
rawatsatish0327
 
The Rust Programming Language Steve Klabnik
The Rust Programming Language Steve Klabnik
nmiriorola
 
The Rust Programming Language Steve Klabnik
The Rust Programming Language Steve Klabnik
willynnekane42
 
Opject orianted programming in c++ for beg
Opject orianted programming in c++ for beg
engahmedeg94
 
JavaScript: Core Part
JavaScript: Core Part
維佋 唐
 
Sugar Presentation - YULHackers March 2009
Sugar Presentation - YULHackers March 2009
spierre
 
The Rust Programming Language 2nd Edition Steve Klabnik
The Rust Programming Language 2nd Edition Steve Klabnik
onutaithakut25
 
Download Complete The Rust Programming Language 2nd Edition Steve Klabnik PDF...
Download Complete The Rust Programming Language 2nd Edition Steve Klabnik PDF...
maggannawsad
 
The Rust Programming Language 2nd Edition Second Converted Steve Klabnik Caro...
The Rust Programming Language 2nd Edition Second Converted Steve Klabnik Caro...
cizekchingbj
 
Software fundamentals
Software fundamentals
Susan Winters
 
Rust concurrency tutorial 2015 12-02
Rust concurrency tutorial 2015 12-02
nikomatsakis
 
Ad

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!
 
Ad

Recently uploaded (20)

MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 

Rust Tutorial | Rust Programming Language Tutorial For Beginners | Rust Training | Edureka

  • 2. Agenda Why learn Rust? What is Rust? Rust Fundamentals 01 02 03 RUST
  • 4. Why Rust? Cargo packet managerConcurrency Memory safety Zero cost abstraction
  • 6. What is Rust? Zero cost abstraction Efficient C binding Ensures memory safety Pattern matching Error messages Threads without data races Rust is a safe, concurrent, systems programming language developed by a Mozilla employee, Graydon Hoare in 2006.
  • 9. Variables Memory location Variable name Variable is a name given to a memory location which acts as a container for storing data. Syntax: 1 let mut age=15; 2 age=16;
  • 10. Constants Constants are fixed values that do not change during execution time. Syntax: 1 2 const x: f32 = 1.54; Examples of constants
  • 12. Compound Data Types - Arrays An array is a data structure that contains a list of elements. These elements are all of the same data type, such as an integer or string. Syntax: 1 2 let arr=[ ]; 0 1 2 3 4 5 6
  • 13. Compound Data Types - Tuple A tuple is a data structure that contains a list of elements. These elements can be of different data type, such as an integer or string. Syntax: 1 2 let tup: (i32, f64, u8) = (200, 1.2, 2); 0 1 2 3 4
  • 14. Strings A string is basically an array of characters. Syntax: 1 2 let mut s = String::new( ); E D U R E K A 0 1 2 3 4 5 6
  • 15. Functions A function is a block of organized, reusable code that is used to perform a single, related action. Functions Predefined Functions User Defined Functions Syntax: 1 2 3 fn greetings( ) { println!(“Hello everyone!”); } name of the function enter parameters here
  • 16. Conditional Statements - If Conditional statement is a set of rules performed if a certain condition is met. It is like an ‘If-Then’ statement. (IF a condition is met, THEN an action is performed) If code End Start True Condition False Exit Syntax: 1 2 3 if(condition) { statement; }
  • 17. Conditional Statements – If else Conditional statement is a set of rules performed if a certain condition is met. It is like an ‘If-Then’ statement. (IF a condition is met, THEN an action is performed) If code End Start True Condition False Else if code Syntax: 1 2 3 4 5 6 if(condition) { statement a; } else { statement b; }
  • 18. Conditional Statements – Else if Conditional statement is a set of rules performed if a certain condition is met. It is like an ‘If-Then’ statement. (IF a condition is met, THEN an action is performed) If code End Start True Condition False Else if code Syntax: 1 2 3 4 5 6 7 8 9 if(condition) { statement a; } else if(condition) { statement b; } else { statement c; }
  • 19. Loop Loop is used to repeat a specific block until some end condition is met. Start Conditional Code Condition False True End loop Syntax: 1 2 3 loop { statements; }
  • 20. For Loop Repeatedly executes the loop code while a given condition is TRUE. It tests the condition before executing the loop body. Start Execute Statement (s) End Next item from sequence If no more itemsItem from sequenceSyntax: 1 2 3 4 for var in expression { block statements; }
  • 21. While Loop While the condition is true, the code within the loop is executed. Start Conditional Code End True False Condition Syntax: 1 2 3 while(condition) { loop code; }
  • 22. Ownership When a block of code owns a resource, it is known as ownership. • Every value has a variable associated which is the owner • There can only be one owner at a time • If the owner goes out of scope, the value associated with it is destroyed RULES Example: 1 2 let x=12; let y=x;
  • 23. Structure A structure is a user-defined data type that consists of variables of different data types. Syntax: 1 2 3 4 5 struct Student { variable: data-type; variable: data-type; } Name Age Father’s name
  • 24. Enum Enum is a custom data type which contains some definite values. Syntax: 1 2 3 4 5 enum enum_name { variant1, variant2, } Stop Ready Go Traffic Signal
  • 25. Modules A module is a namespace which contains the definitions of the functions or its types. A module is a collection of items such as functions, traits, structs, blocks. Syntax: 1 2 3 mod module_name { module body } • mod - declares the new module • pub - makes the visibility modifier as public & accessible outside the namespace • use - to import the module into local scope Keywords used in modules:
  • 26. Vectors Vectors allow you to store more than one value in a single data structure that puts all the values next to each other in memory. Syntax: 1 2 let v : Vec<i32> = Vec::new( ); • Stores values of the same data type • It is denoted by Vec<T> • It is a growable array Key points of Vectors: