SlideShare a Scribd company logo
1 of 54
Introduction to Rust
Programming language
By
Kent Marete
Twitter: @kentccs
github: maretekent
History of computers
• First "computer” word use was
recorded in 1613 - referring to a person
calculations, or computations.
• Tools –Abacus, Napier bones, slide rule,
pascaline, stepped reckoner etc.
• Difference Engine and Analytical Engine
- first mechanical computer
• Invented by Charles Babbage in 1822
and 1834
Charles Babbage
History of computers
• In 1840, Augusta Ada Byron suggests to Babbage that he use the
binary system.
• She writes programs for the Analytical Engine.
• She was the first programmer
Ada lovelace
First Programmers early 1930’s, 40’s ACE
Computer Generations
There are five generations
• First generation – 1946 – 1958 -- vacuum tubes for circuitry
and magnetic drums for memory. -solve one problem at a time
• Second generation – 1959 - 1964 -- Transistors replaced
vacuum tubes
• Third generation – 1965 - 1970 -- integrated circuit - silicon
chips
• Fourth generation – 1971 - today – microprocessor many ICs
• Fifth generation – Today to future -- Artificial Intelligence (AI)
Father of modern Computers
Machine code
• Instruction consist of operation code (op code) and Operand
• All are binary codes
• Machine code program consists of seq. of op code and operand are
stored in computer memory e.g. RAM
operand -part of a computer instruction that specifies data
Op code - part of a computer instruction that specifies
what operation
LD A, 01H
Opcode (load)
Register
Data (1)
Hex
Machine code
opcode
operand
MOV A, B
Assembly -- Mnemonics
High Level programming Languages
• Program - Set of instructions
• Programming - The art of creating programs
01010100
01101010
10001111
01111010
HLL – uses mathematical
symbols and english like syntax,
easy to learn, read.
Compiler,
Interpreters
and
assemblers
Low level language
High Level programming languages
Compiled languages - compiled code can be
executed directly by the computer's CPU.
the original program is translated into native
machine instructions, which are executed
directly by the hardware
Interpreted languages - translated at run-
time from any format to CPU machine
instructions
High Level programming languages
• Commands
• Syntax
• logic
HLL are portable and can run on multiple computers unlike
low level languages
Compiler - translates comp. program in HLL to machine code
Interpreter - translates comp. program in HLL to machine
code line by line
High Level programming languages
• Movie translation scenario - subtitles --- compiler
• Summit meetings interpretation of foreign lang --- interpreter
• Compiled lang: C, C++, Rust, Fotran, COBOL
• Interpreted lang: Python, Perl, Ruby
Systems programming is making of systems program.
Systems program are used to develop application programs
What is Rust?
• Rust is a systems programming language that runs blazingly fast, prevents
segfaults, and guarantees thread safety. (safety, concurrency, and speed)
• It’s a programming language founded by Mozilla research.
Rust
C++
Java
Python
Haskell
Scala
C
Perl
PHP
Javascript D
RubyC#
go
What Rust has to offer
• We can organize these languages in a linear spectrum
Control Safety
C C++ D Java
Python
Ruby
JS
Haskel
Scala
RUST
What Rust has built? / who is using Rust?
• Wasm – editors, browser game engines, https://www.figma.com
https://www.youtube.com/watch?v=ysFJHpS-O08
• Games - https://www.amethyst.rs/
-https://kripken.github.io/BananaBread/cube2/bb.html
• Block chain – etherium, exonum, crytape
• Friends of Rust - https://www.rust-lang.org/en-US/friends.html
• Jumo – cloud env manager
Table of content
• Rust, Cargo, Setup
• Syntax + Concepts mostly the same as other languages
• Syntax + Concepts particular to Rust
What is Cargo?
• Package manager
• Build tool
• Test runner
• Documentation generator
Setting up a Project
We're going to be making a binary project; the other option is a library.
cargo new will create a skeleton project setup for you.
1. cd to a directory where you like to store code
2. cargo new rustbridge
3. cd rustbridge
If you use version control, now would be a good time to commit.
Files created
• Cargo.toml: metadata about your project and its dependencies
• .gitignore: ignores compiled files built by Rust
• src/main.rs: where your Rust code goes
Cargo.toml
[package]
name = "rustbridge"
version = "0.1.0"
authors = [”Kent Marete <maretekent@gmail.com>"]
[dependencies]
src/main.rs
fn main() {
println!("Hello, world!");
}
Run it!
• cargo run
• Should print "Hello, world!"
• Now you have more files:
• target directory: all the built stuff
• Cargo.lock: locks your dependencies (we don't have any yet)
• Try printing out something else!
• Try printing out two things!
Syntax + Concepts mostly the same as
other languages
Comments
• Double slash at the beginning of a line (//)
• Try commenting out one of your lines printing!
• There are other kinds of comments but this is the most common
Variables
• let a:u8 = 123; // unsigned, immutable
• let mut b:i8 = 0; // mutable
• let mut c = 123456789; // it's an i32!
• let d:char = 'x'; // no type deco, single 32-bit unicode character
• let f:f64 = 2.5; // default float type
• let g = false; // true, g is of type boolean
• let name = "ashley";
Mutability
• let mut apples = 100;
• apples += 50;
• println!("I have {} apples", apples);
Type inference
• Every value has a type that the compiler has to know about.
• Most of the time, the compiler can figure it out.
• Sometimes it can't, and you'll get an error and need to add an
annotation.
• We could have written let age: i32 = 30;
• A place we must specify types is function definitions.
Functions
Conditionals if
Conditionals match
Arrays
Quick but Useful Tangent #1: println! formatting
• {} is called Display formatting; only on primitive types by default
• {:?} is called Debug formatting; more types have this by default
• Display is for end users, Debug is for... debugging
• Rust doesn't want to make assumptions
• My favorite: {:#?} = pretty debug
Quick but Useful Tangent #2: panic!
Panic stops your program with a message.
What happens in the last example if we try to access an element out of bounds of the array?
Vectors
• Vectors are dynamic arrays
Looping (and ranges)
Iterators
Enums
Control Flows
• While loop
loop
Control flows
• Match
• if
For loop
Syntax + Concepts particular to Rust
Result
Result
Result
Option
Slices
Slices Syntax
String Slices
Ownership
Transferring Ownership
References
Mutable References
Crates
http://crates.io
End

More Related Content

What's hot

D1T3-Anto-Joseph-Droid-FF
D1T3-Anto-Joseph-Droid-FFD1T3-Anto-Joseph-Droid-FF
D1T3-Anto-Joseph-Droid-FF
Anthony Jose
 

What's hot (20)

P1 2017 python
P1 2017 pythonP1 2017 python
P1 2017 python
 
Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with Elixir
 
Advanced Linux Game Programming
Advanced Linux Game ProgrammingAdvanced Linux Game Programming
Advanced Linux Game Programming
 
One Year of Porting - Post-mortem of two Linux/SteamOS launches
One Year of Porting - Post-mortem of two Linux/SteamOS launchesOne Year of Porting - Post-mortem of two Linux/SteamOS launches
One Year of Porting - Post-mortem of two Linux/SteamOS launches
 
Python and web driver
Python and web driverPython and web driver
Python and web driver
 
Linux as a gaming platform - Errata
Linux as a gaming platform - ErrataLinux as a gaming platform - Errata
Linux as a gaming platform - Errata
 
D1T3-Anto-Joseph-Droid-FF
D1T3-Anto-Joseph-Droid-FFD1T3-Anto-Joseph-Droid-FF
D1T3-Anto-Joseph-Droid-FF
 
Lua and its Ecosystem
Lua and its EcosystemLua and its Ecosystem
Lua and its Ecosystem
 
Linux as a gaming platform, ideology aside
Linux as a gaming platform, ideology asideLinux as a gaming platform, ideology aside
Linux as a gaming platform, ideology aside
 
Amazing KDE (K Desktop Environment)
Amazing KDE (K Desktop Environment)Amazing KDE (K Desktop Environment)
Amazing KDE (K Desktop Environment)
 
Presentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStackPresentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStack
 
Rust Programming Language
Rust Programming LanguageRust Programming Language
Rust Programming Language
 
Spacebrew: The Overview
Spacebrew: The OverviewSpacebrew: The Overview
Spacebrew: The Overview
 
A hands-on introduction to the ELF Object file format
A hands-on introduction to the ELF Object file formatA hands-on introduction to the ELF Object file format
A hands-on introduction to the ELF Object file format
 
A(n abridged) tour of the Rust compiler [PDX-Rust March 2014]
A(n abridged) tour of the Rust compiler [PDX-Rust March 2014]A(n abridged) tour of the Rust compiler [PDX-Rust March 2014]
A(n abridged) tour of the Rust compiler [PDX-Rust March 2014]
 
Gamedev-grade debugging
Gamedev-grade debuggingGamedev-grade debugging
Gamedev-grade debugging
 
Killer Robots 101 with Gobot
Killer Robots 101 with GobotKiller Robots 101 with Gobot
Killer Robots 101 with Gobot
 
Introduction to Python for Security Professionals
Introduction to Python for Security ProfessionalsIntroduction to Python for Security Professionals
Introduction to Python for Security Professionals
 
Packer Genetics: The selfish code
Packer Genetics: The selfish codePacker Genetics: The selfish code
Packer Genetics: The selfish code
 
MozillaPH Rust Hack & Learn Session 2
MozillaPH Rust Hack & Learn Session 2MozillaPH Rust Hack & Learn Session 2
MozillaPH Rust Hack & Learn Session 2
 

Similar to Rustbridge

Assembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly LangaugeAssembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly Langauge
mustafkhalid
 
Linux operating system by Quontra Solutions
Linux operating system by Quontra SolutionsLinux operating system by Quontra Solutions
Linux operating system by Quontra Solutions
QUONTRASOLUTIONS
 
Programming Languages #devcon2013
Programming Languages #devcon2013Programming Languages #devcon2013
Programming Languages #devcon2013
Iván Montes
 

Similar to Rustbridge (20)

2016 bioinformatics i_python_part_1_wim_vancriekinge
2016 bioinformatics i_python_part_1_wim_vancriekinge2016 bioinformatics i_python_part_1_wim_vancriekinge
2016 bioinformatics i_python_part_1_wim_vancriekinge
 
Assembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly LangaugeAssembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly Langauge
 
P1 2018 python
P1 2018 pythonP1 2018 python
P1 2018 python
 
Natural Language Processing Tools for the Digital Humanities
Natural Language Processing Tools for the Digital HumanitiesNatural Language Processing Tools for the Digital Humanities
Natural Language Processing Tools for the Digital Humanities
 
computer languages
computer languagescomputer languages
computer languages
 
Programming skills
Programming skillsProgramming skills
Programming skills
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
MozillaPH Rust Hack & Learn Session 1
MozillaPH Rust Hack & Learn Session 1MozillaPH Rust Hack & Learn Session 1
MozillaPH Rust Hack & Learn Session 1
 
Introduction to multicore .ppt
Introduction to multicore .pptIntroduction to multicore .ppt
Introduction to multicore .ppt
 
Linux operating system by Quontra Solutions
Linux operating system by Quontra SolutionsLinux operating system by Quontra Solutions
Linux operating system by Quontra Solutions
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
2015 bioinformatics python_introduction_wim_vancriekinge_vfinal
2015 bioinformatics python_introduction_wim_vancriekinge_vfinal2015 bioinformatics python_introduction_wim_vancriekinge_vfinal
2015 bioinformatics python_introduction_wim_vancriekinge_vfinal
 
Programming Languages #devcon2013
Programming Languages #devcon2013Programming Languages #devcon2013
Programming Languages #devcon2013
 
Synapseindia dot net development computer programming
Synapseindia dot net development  computer programmingSynapseindia dot net development  computer programming
Synapseindia dot net development computer programming
 
C101 – Intro to Programming with C
C101 – Intro to Programming with CC101 – Intro to Programming with C
C101 – Intro to Programming with C
 
Plc part 1
Plc part 1Plc part 1
Plc part 1
 
Evolution of Programming Languages.pdf
Evolution of Programming Languages.pdfEvolution of Programming Languages.pdf
Evolution of Programming Languages.pdf
 
Evolution of Programming Languages.pdf
Evolution of Programming Languages.pdfEvolution of Programming Languages.pdf
Evolution of Programming Languages.pdf
 
redhat_by_Cbitss.ppt
redhat_by_Cbitss.pptredhat_by_Cbitss.ppt
redhat_by_Cbitss.ppt
 
Introduction+to+java+2
Introduction+to+java+2Introduction+to+java+2
Introduction+to+java+2
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Rustbridge

  • 1. Introduction to Rust Programming language By Kent Marete Twitter: @kentccs github: maretekent
  • 2. History of computers • First "computer” word use was recorded in 1613 - referring to a person calculations, or computations. • Tools –Abacus, Napier bones, slide rule, pascaline, stepped reckoner etc. • Difference Engine and Analytical Engine - first mechanical computer • Invented by Charles Babbage in 1822 and 1834 Charles Babbage
  • 3. History of computers • In 1840, Augusta Ada Byron suggests to Babbage that he use the binary system. • She writes programs for the Analytical Engine. • She was the first programmer Ada lovelace
  • 4. First Programmers early 1930’s, 40’s ACE
  • 5. Computer Generations There are five generations • First generation – 1946 – 1958 -- vacuum tubes for circuitry and magnetic drums for memory. -solve one problem at a time • Second generation – 1959 - 1964 -- Transistors replaced vacuum tubes • Third generation – 1965 - 1970 -- integrated circuit - silicon chips • Fourth generation – 1971 - today – microprocessor many ICs • Fifth generation – Today to future -- Artificial Intelligence (AI)
  • 6. Father of modern Computers
  • 7. Machine code • Instruction consist of operation code (op code) and Operand • All are binary codes • Machine code program consists of seq. of op code and operand are stored in computer memory e.g. RAM operand -part of a computer instruction that specifies data Op code - part of a computer instruction that specifies what operation LD A, 01H Opcode (load) Register Data (1) Hex
  • 8. Machine code opcode operand MOV A, B Assembly -- Mnemonics
  • 9. High Level programming Languages • Program - Set of instructions • Programming - The art of creating programs 01010100 01101010 10001111 01111010 HLL – uses mathematical symbols and english like syntax, easy to learn, read. Compiler, Interpreters and assemblers Low level language
  • 10. High Level programming languages Compiled languages - compiled code can be executed directly by the computer's CPU. the original program is translated into native machine instructions, which are executed directly by the hardware Interpreted languages - translated at run- time from any format to CPU machine instructions
  • 11. High Level programming languages • Commands • Syntax • logic HLL are portable and can run on multiple computers unlike low level languages Compiler - translates comp. program in HLL to machine code Interpreter - translates comp. program in HLL to machine code line by line
  • 12. High Level programming languages • Movie translation scenario - subtitles --- compiler • Summit meetings interpretation of foreign lang --- interpreter • Compiled lang: C, C++, Rust, Fotran, COBOL • Interpreted lang: Python, Perl, Ruby Systems programming is making of systems program. Systems program are used to develop application programs
  • 13. What is Rust? • Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. (safety, concurrency, and speed) • It’s a programming language founded by Mozilla research. Rust C++ Java Python Haskell Scala C Perl PHP Javascript D RubyC# go
  • 14. What Rust has to offer • We can organize these languages in a linear spectrum Control Safety C C++ D Java Python Ruby JS Haskel Scala RUST
  • 15. What Rust has built? / who is using Rust? • Wasm – editors, browser game engines, https://www.figma.com https://www.youtube.com/watch?v=ysFJHpS-O08 • Games - https://www.amethyst.rs/ -https://kripken.github.io/BananaBread/cube2/bb.html • Block chain – etherium, exonum, crytape • Friends of Rust - https://www.rust-lang.org/en-US/friends.html • Jumo – cloud env manager
  • 16. Table of content • Rust, Cargo, Setup • Syntax + Concepts mostly the same as other languages • Syntax + Concepts particular to Rust
  • 17. What is Cargo? • Package manager • Build tool • Test runner • Documentation generator
  • 18. Setting up a Project We're going to be making a binary project; the other option is a library. cargo new will create a skeleton project setup for you. 1. cd to a directory where you like to store code 2. cargo new rustbridge 3. cd rustbridge If you use version control, now would be a good time to commit.
  • 19. Files created • Cargo.toml: metadata about your project and its dependencies • .gitignore: ignores compiled files built by Rust • src/main.rs: where your Rust code goes
  • 20. Cargo.toml [package] name = "rustbridge" version = "0.1.0" authors = [”Kent Marete <maretekent@gmail.com>"] [dependencies]
  • 22. Run it! • cargo run • Should print "Hello, world!" • Now you have more files: • target directory: all the built stuff • Cargo.lock: locks your dependencies (we don't have any yet) • Try printing out something else! • Try printing out two things!
  • 23. Syntax + Concepts mostly the same as other languages
  • 24. Comments • Double slash at the beginning of a line (//) • Try commenting out one of your lines printing! • There are other kinds of comments but this is the most common
  • 25.
  • 26. Variables • let a:u8 = 123; // unsigned, immutable • let mut b:i8 = 0; // mutable • let mut c = 123456789; // it's an i32! • let d:char = 'x'; // no type deco, single 32-bit unicode character • let f:f64 = 2.5; // default float type • let g = false; // true, g is of type boolean • let name = "ashley";
  • 27. Mutability • let mut apples = 100; • apples += 50; • println!("I have {} apples", apples);
  • 28. Type inference • Every value has a type that the compiler has to know about. • Most of the time, the compiler can figure it out. • Sometimes it can't, and you'll get an error and need to add an annotation. • We could have written let age: i32 = 30; • A place we must specify types is function definitions.
  • 33. Quick but Useful Tangent #1: println! formatting • {} is called Display formatting; only on primitive types by default • {:?} is called Debug formatting; more types have this by default • Display is for end users, Debug is for... debugging • Rust doesn't want to make assumptions • My favorite: {:#?} = pretty debug
  • 34. Quick but Useful Tangent #2: panic! Panic stops your program with a message. What happens in the last example if we try to access an element out of bounds of the array?
  • 35. Vectors • Vectors are dynamic arrays
  • 38. Enums
  • 41. Syntax + Concepts particular to Rust
  • 54. End

Editor's Notes

  1. It gives us control, we know what will run on our machines