← Back to home

Notes from 'Programming Rust' book

Just some from the 'Programming Rust' O'Reilly book.

Here are some of my notes from the Programming Rust O’Reilly book. I’m posting them here and in a gist on github so they’re searchable to me and anyone else who needs them.

Chapter 1

(omitted for brevity)

Chapter 2: Tour of Rust

Chapter 3: Basic Types

Chapter 4: Ownership

Chapter 5: References

Chapter 7: Error Handling

Chapter 8: Crates and Modules

Chapter 9: Structs

eg:

struct Position<'p> {
 x: & 'p i32,
 x: & 'p i32,
}

Chapter 10: Enums and Patterns

something like

match x {
 Ok(v) => println!("{}", v)
 Unknown(err) => println!("{}", err),
 _ => panic!("uh oh")
}

@ pattern matches the pattern, but it moves or copies the entire value into the produced variable

Chapter 11: Traits and Generics

trait Write {
 fn write() -> Result<usize>;
}
trait Thing: Other {
 ...
}

Chapter 12: Operator Overloading

Chapter 13: Utility Traits

Chapter 14: Closure

Chapter 15: Iterators

Chapter 16: Collections

Chapter 17: Strings and Text

Chapter 18: Input and Output

Chapter 19: Concurrency

Chapter 20: Macros

Chapter 21: Unsafe Code

programming | rust | notes
2020-07-04