I started learning Rust in December last year by building a command-line tool to display NHL results on the terminal. My background before Rust has been mostly on Python and Javascript ecosystems so there's been quite a learning curve that has required activating new parts of my brain.
In this talk, I'll share my early learning journey with Rust. I'll talk openly about the things I struggled with and the things I fell in love with in Rust (like pattern matching).
2. “The value of another’s experience
is to give us hope, not to tell us
how or whether to proceed”
Rust Denver
“The Answer to How is Yes”
by Peter Block
3. Rust Denver
Hi, I’m Juhis!
from Helsinki, Finland 🇫🇮
(it’s 3.30 am here)
Developer Advocate at Futurice
I build developer communities
https://hamatti.org
twitter.com/hamatti
14. Rust Denver
##[derive(Debug, Serialize, Deserialize)]
pub struct APIResponse {
pub date: {
pub raw: Option<String>,
pub pretty: String,
},
pub games: Vec<GameResponse>,
pub errors: Option<HashMap<String, serde_json:::Value>>>,
}
What I’d like to do
15. ❤ Things I really like, #2 ❤
Rust Denver
rustdoc & doctests
16. Rust Denver
impl Person {
///// Returns a person with the name given them
/////
///// # Arguments
/////
///// * `name` - A string slice that holds the name of the person
/////
///// # Examples
/////
///// ```
///// /// You can have rust code between fences inside the comments
///// /// If you pass ---test to `rustdoc`, it will even test it for you!
///// use doc:::Person;
///// let person = Person:::new(“Juhis");
///// assert_eq!(person.name, String:::from(“Juhis”));
///// ```
pub fn new(name: &str) ->- Person {
Person {
name: name.to_string(),
}
}
}
17. 🙈 Things I struggle with, #2
Rust Denver
Ownership, borrows,
lifetime, references
20. Rust Denver
“The Rust compiler is very kind and I tweeted last
week about how the language matters. When I'm
stressed about all the red in my terminal, a kind
tone of voice the compiler has definitely makes it
easier to deal with.” “Advent of Code #2: Borrows,
unwraps and lots of compiler errors”
by me
21. 🙈 Things I struggle with, #3
Rust Denver
Verbosity and cascade
of error handling
22. ❤ Things I really like, #3 ❤
Rust Denver
Rustaceans
23. Rust Denver
Learning Rust
A monthly blog series
https://hamatti.org/blog/
#1: Pattern Matching
#2: Option & Result
#3: crates.io
#4: Parsing JSON with strong types
#5: Rustlings
+ new one every first Wed of the month
24. Rust Denver
codebase
Livestream on Youtube
https://hamatti.org/codebase
#1: Accessible forms with HTML
#2: Backend with Clojure
#3: PHP is awesome
#4: Frontend with Web Components
+ new one every month
25. Rust Denver
Thanks for having me!
Time for Q&A!
For more of me
@hamatti in Twitter
hamatti.org