We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← All tracks
0 / 4
Shape Your Data: Structs, Enums, Pattern Matching
RustModel the domain so illegal states do not compile. Structs, enums, exhaustive `match`, newtypes and the builder — where the type system first does work you can feel.
This track is written for Rust, which isn't the mode you're browsing in.
0
/ 24 solved
· 2 articles
- 1. Not solved yet. Structs: naming your data
- 2. Not solved yet. Field init shorthand and struct update syntax
- 3. Not solved yet. Tuple structs and unit structs: the other two shapes
- 4. Not solved yet. impl blocks: associated functions, methods, Self and associated constants
- 5. Not solved yet. Deriving traits, and when derive gets the bounds wrong
- 6. Not solved yet. Enums are real sum types
- 7. Not solved yet. match and exhaustiveness: the compiler as a checklist
- 8. Not solved yet. The wildcard trap: `_` arms freeze your enum against the future
- 9. Not solved yet. Literal, range and or-patterns
- 10. Not solved yet. Binding with @, and what or-patterns demand of bindings
- 11. Not solved yet. Destructuring structs and nested patterns
- 12. Not solved yet. Slice and array patterns, and rest @ ..
- 13. Not solved yet. Match guards, and why they don't count toward exhaustiveness
- 14. Not solved yet. Refutability, and every place a pattern can appear
- 15. Not solved yet. if let, while let, and let ... else
- 16. Not solved yet. Let-chains: the edition-2024 feature that deletes your nesting
- 17. Not solved yet. matches! and the lints that push you toward it
- 18. Not solved yet. #[derive(Debug)] and the three shapes of debug output
- 19. Not solved yet. PartialEq and Eq: why floats can be compared but not Eq
- 20. Not solved yet. PartialOrd and Ord: derived ordering follows declaration order
- 21. Not solved yet. Hash and the Hash/Eq contract
- 22. Not solved yet. Default, #[default] on an enum variant, and ..Default::default()
- 23. Not solved yet. Discriminants, #[repr(u8)], as casts and mem::discriminant
- 24. #[non_exhaustive]: designing enums you can extend later Read
- 25. Not solved yet. pub on structs and enums behaves differently
- 26. Struct-of-enums vs enum-of-structs: choosing the axis of variation Read
Check yourself
4 questions · one attempt eachThese do not count toward finishing the track. They are here to catch the things that are easy to read past.
Why is Option<Box<u8>> the same size as Box<u8>, while Option<u8> is bigger than u8?
size_of::<Option<Box<u8>>>()
size_of::<Box<u8>>()
size_of::<Option<u8>>()
Question 1 of 4