Rust Data StructuresLesson 27Free preview
Rust Structs
This lesson is part of Rust · All levels
Summary
This lesson paints Struct which is the foundation for creating custom object-oriented data types in Rust. Struct allows for the grouping of data with meaningful attribute names. Developers will also learn how to embed the method and associated function into the struct using the 'impl' block.
Key points
- Struct is used to define custom data types with fields called
- Supports regular struct, tuple struct, and unit-like struct without field
- Method is defined within the 'impl' implementation block
- The parameter '&self' is used in the method to access struct instance data
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.