Structs, enums and pattern matching
Model a domain with precise types, and let match check every case.
- 1StructsGroup named data into a type of your own.
- 2Methods and impl blocksAttach behavior to a type: &self, &mut self, self and new.
- 3EnumsA type that is one of several variants, each with its own data.
- 4Pattern matchingDestructure, filter with guards, and if let for a single case.
- ◆Project: the domain modelRunning projectTrade, Instrument and NettingSet: riskforge moves from bare f64 values to real types.