typeover
rust curriculum

Curriculum Data modeling Structs and impl blocks exercise 4 · fill-word

Structs and impl blocks

Fill the keyword that attaches methods to a struct. Goes directly before the type name.

TypeScript reference
Fill the blanks →

About this theme

Rust separates data declarations from method implementations. A struct names fields; an impl block attaches constructors and methods. Planned exercises: 1. choose struct declaration syntax. 2. recognise named-field literals. 3. choose Self in a constructor. 4. fill an impl block. 5. fill a &self method. 6. write a constructor. 7. write a read-only method. 8. translate a TS object with methods. 9. fix an accidental move out of self.