How To Learn Rust
5/19/2016
talks.edunham.net/oscon2016 @qedunham [email protected]
talks.edunham.net/oscon2016
[email protected]talks.edunham.net/oscon2016 @qedunham [email protected]
Two Talks In One
talks.edunham.net/oscon2016 @qedunham [email protected]
Thanks
@anjuan @glasnt @jackyboen @megamatman
@Azuxul @gmebarthe @joaomello @Mike_Fal
@bulba_zord @hectorjcorrea @jsookha @proogey
@echorand @iamed2 @l.d.walker @robn
@EnamsuoBarry @IanBertolacci @llogiq @sundayayandokun
@FranklinWaller @Ignoreintuition @macaronique @Vinatorul
@gansai9 @itsAhmedWay @mayaskme http://agares.info/
talks.edunham.net/oscon2016 @qedunham [email protected]
Today’s Audience
talks.edunham.net/oscon2016 @qedunham [email protected]
Your Next Language
talks.edunham.net/oscon2016 @qedunham [email protected]
Curiosity
talks.edunham.net/oscon2016 @qedunham [email protected]
Features
talks.edunham.net/oscon2016 @qedunham [email protected]
Work
talks.edunham.net/oscon2016 @qedunham [email protected]
Why?
talks.edunham.net/oscon2016 @qedunham [email protected]
Pattern Recognition
talks.edunham.net/oscon2016 @qedunham [email protected]
Your Next Language
talks.edunham.net/oscon2016 @qedunham [email protected]
Learning Styles
talks.edunham.net/oscon2016 @qedunham [email protected]
Tasks You Enjoy
vs
Tasks You Despise
talks.edunham.net/oscon2016 @qedunham [email protected]
Successful Projects
vs
Unsuccessful Projects
talks.edunham.net/oscon2016 @qedunham [email protected]
What will you achieve?
&
When?
talks.edunham.net/oscon2016 @qedunham [email protected]
Which Language?
talks.edunham.net/oscon2016 @qedunham [email protected]
Popularity
talks.edunham.net/oscon2016 @qedunham [email protected]
Community
talks.edunham.net/oscon2016 @qedunham [email protected]
Resources
talks.edunham.net/oscon2016 @qedunham [email protected]
Features
talks.edunham.net/oscon2016 @qedunham [email protected]
Old & New Concepts
talks.edunham.net/oscon2016 @qedunham [email protected]
“My next language _____”
talks.edunham.net/oscon2016 @qedunham [email protected]
It’s worth taking time from...
talks.edunham.net/oscon2016 @qedunham [email protected]
Family? Hobbies? Sleep?
talks.edunham.net/oscon2016 @qedunham [email protected]
Capture Your Motivation
talks.edunham.net/oscon2016 @qedunham [email protected]
12 Study Techniques
talks.edunham.net/oscon2016 @qedunham [email protected]
1) Language Docs
talks.edunham.net/oscon2016 @qedunham [email protected]
2) Similar Languages
talks.edunham.net/oscon2016 @qedunham [email protected]
3) Community Support
talks.edunham.net/oscon2016 @qedunham [email protected]
4) Write Real Code
talks.edunham.net/oscon2016 @qedunham [email protected]
5) Read The Books
talks.edunham.net/oscon2016 @qedunham [email protected]
6) Examine Examples
talks.edunham.net/oscon2016 @qedunham [email protected]
7) Find Good Tools
talks.edunham.net/oscon2016 @qedunham [email protected]
8) Read Real Code
talks.edunham.net/oscon2016 @qedunham [email protected]
9) Write Toy Programs
talks.edunham.net/oscon2016 @qedunham [email protected]
10) Google & Stackoverflow
talks.edunham.net/oscon2016 @qedunham [email protected]
11) Watch Lectures & Courses
talks.edunham.net/oscon2016 @qedunham [email protected]
12) Maintain Enthusiasm
talks.edunham.net/oscon2016 @qedunham [email protected]
Troubleshooting
talks.edunham.net/oscon2016 @qedunham [email protected]
Community Interaction
talks.edunham.net/oscon2016 @qedunham [email protected]
Time
talks.edunham.net/oscon2016 @qedunham [email protected]
Language features
talks.edunham.net/oscon2016 @qedunham [email protected]
Advice
talks.edunham.net/oscon2016 @qedunham [email protected]
Learn by Doing
talks.edunham.net/oscon2016 @qedunham [email protected]
Practice Consistently
talks.edunham.net/oscon2016 @qedunham [email protected]
Start with the Basics
talks.edunham.net/oscon2016 @qedunham [email protected]
Build Something You Love
talks.edunham.net/oscon2016 @qedunham [email protected]
Respect Languages’ Differences
talks.edunham.net/oscon2016 @qedunham [email protected]
It Gets Better
talks.edunham.net/oscon2016 @qedunham [email protected]
Learning Rust!
talks.edunham.net/oscon2016 @qedunham [email protected]
Are You Ready?
talks.edunham.net/oscon2016 @qedunham [email protected]
www.rust-lang.org
1.0 on May 15, 2015
talks.edunham.net/oscon2016 @qedunham [email protected]
Systems Programming.
Safe, Concurrent, Fast.
talks.edunham.net/oscon2016 @qedunham [email protected]
Memory Safety, no GC.
Ownership + Lifetimes.
Types & Traits.
talks.edunham.net/oscon2016 @qedunham [email protected]
“I am learning @rustlang to ___”
talks.edunham.net/oscon2016 @qedunham [email protected]
1) Language Docs
doc.rust-lang.org
talks.edunham.net/oscon2016 @qedunham [email protected]
2) Similar Languages
github.com/ctjhoa/rust-learning/
talks.edunham.net/oscon2016 @qedunham [email protected]
3) Community Support
www.rust-lang.org/community.html
users.rust-lang.org
#rust-beginners on irc.mozilla.org
talks.edunham.net/oscon2016 @qedunham [email protected]
4) Write Real Code
GitHub search “is:open is:issue language:rust”
starters.servo.org
talks.edunham.net/oscon2016 @qedunham [email protected]
5) Read The Books
doc.rust-lang.org/book
O’Reilly, Programming Rust
Packt Publishing, Rust Essentials
talks.edunham.net/oscon2016 @qedunham [email protected]
6) Examine Examples
rustbyexample.com
Carol’s rustlings
Rosetta Code
talks.edunham.net/oscon2016 @qedunham [email protected]
7) Find Good Tools
play.rust-lang.org
Clippy and Rustfmt
IDE support
talks.edunham.net/oscon2016 @qedunham [email protected]
8) Read Real Code
crates.io popular libraries
The Rust Compiler
Rust in Production
talks.edunham.net/oscon2016 @qedunham [email protected]
9) Write Toy Programs
Rust by Example
exercism.io
Project Euler
Hackerrank
talks.edunham.net/oscon2016 @qedunham [email protected]
10) Google & Stackoverflow
Stackoverflow Rust tag
talks.edunham.net/oscon2016 @qedunham [email protected]
11) Watch Lectures & Courses
rust-learning list
talks.edunham.net/oscon2016 @qedunham [email protected]
12) Maintain Enthusiasm
Rust subreddit
This Week In Rust
talks.edunham.net/oscon2016 @qedunham [email protected]
Errors are here to help
talks.edunham.net/oscon2016 @qedunham [email protected]
Basic Syntax
talks.edunham.net/oscon2016 @qedunham [email protected]
Scope Errors!
talks.edunham.net/oscon2016 @qedunham [email protected]
Punctuation Errors
talks.edunham.net/oscon2016 @qedunham [email protected]
Unused Variables
talks.edunham.net/oscon2016 @qedunham [email protected]
Hey, Pythonistas!
talks.edunham.net/oscon2016 @qedunham [email protected]
Hey, Pythonistas!
talks.edunham.net/oscon2016 @qedunham [email protected]
Primitive types (built-in)
●
bool ●
f32, f64
●
char ●
isize, usize
●
i8, i16, i32, ●
str
i64 ●
tuple
●
u8, u16, u32,
u64
https://doc.rust-lang.org/book/primitive-types.html
talks.edunham.net/oscon2016 @qedunham [email protected]
Function Type Signatures
talks.edunham.net/oscon2016 @qedunham [email protected]
Function with a type signature
talks.edunham.net/oscon2016 @qedunham [email protected]
Synonymous return
talks.edunham.net/oscon2016 @qedunham [email protected]
Type Errors
talks.edunham.net/oscon2016 @qedunham [email protected]
Anything you can add...
https://doc.rust-lang.org/std/ops/trait.Add.html
talks.edunham.net/oscon2016 @qedunham [email protected]
Traits
talks.edunham.net/oscon2016 @qedunham [email protected]
Additional Resources
●
https://doc.rust-lang.org/book/traits.html
●
http://blog.rust-lang.org/2015/05/11/traits.html
●
http://rustbyexample.com/trait.html
●
http://pcwalton.github.io/blog/2012/08/08/a-gentle-i
ntroduction-to-traits-in-rust/
talks.edunham.net/oscon2016 @qedunham [email protected]
Ownership Rules
●
No borrow may outlive value's owner
●
Exactly 1 mutable reference (&mut T)
–
OR
●
As many read-only references (&T) as you
want
talks.edunham.net/oscon2016 @qedunham [email protected]
Giving Away a Value
talks.edunham.net/oscon2016 @qedunham [email protected]
Given away means gone
talks.edunham.net/oscon2016 @qedunham [email protected]
Borrow the value
talks.edunham.net/oscon2016 @qedunham [email protected]
Make a mutable copy
talks.edunham.net/oscon2016 @qedunham [email protected]
Review
●
Only owner can access value
●
1 mutable reference or unlimited read-only
references to each value
●
Borrow may not outlive owner
talks.edunham.net/oscon2016 @qedunham [email protected]
Additional Resources
●
http://doc.rust-lang.org/stable/book/ownership.html
●
http://doc.rust-lang.org/stable/book/references-and-borrowing.ht
ml
●
Why the to_string()?
http://hermanradtke.com/2015/05/03/string-vs-str-in-rust-function
s.html
●
http://rustbyexample.com/trait/clone.html
●
https://www.reddit.com/r/rust/comments/2xxjda/when_should_m
y_type_be_copy/
talks.edunham.net/oscon2016 @qedunham [email protected]
It Gets Better
talks.edunham.net/oscon2016 @qedunham [email protected]
Thank You
talks.edunham.net/oscon2016
Photos at https://www.flickr.com/photos/143305168@N08/favorites
talks.edunham.net/oscon2016 @qedunham [email protected]