Curriculum Traits & generics Derive and common traits exercise 4 · fill-word
Derive and common traits
Fill the trait list inside the derive attribute so the struct
gets both Debug and Clone impls.
TypeScript reference
Fill the blanks →
About this theme
Rust leans on a small set of common traits: Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, and Hash. Derive is the idiomatic way to ask the compiler for boring implementations. Planned exercises: 1. choose #[derive(Debug)]. 2. recognise derived equality. 3. choose Clone vs Copy. 4. fill a derive list. 5. fill a Debug print. 6. write a comparable struct. 7. write a default value. 8. translate TS equality assumptions. 9. fix a HashMap key type that lacks the required traits.