Structs, Traits, and Enums
Learn the basic way to organize data.
Structs
A struct
is a data structure that allows us to group related features.
It can be compared to a class
in an OOP language. We can have:
- Public and private methods through
impl
. - Public and private properties through
fields
. - Multiple inheritance through traits.