Rust code examples
8 short, tested snippets. Pick one to see the code with notes, or search Zest for something specific, such as “rust read a file”.
- Read a fileuse std::fs;
- Struct with implstruct User {
- Enum and matchenum Shape {
- Option and Result with ?use std::num::ParseIntError;
- Iterators: map, filter, collectlet nums = vec![1, 2, 3, 4];
- HashMapuse std::collections::HashMap;
- Spawn a threaduse std::thread;
- Hello worldfn main() {