Module 3Result & LabLesson 9 of 925 min
Module 3 Lab: Order Ticket
Combine Side, Order, describe, notional, and validate.
Build this ticket model
enum Side { Buy, Sell }struct Order { side, ticker, qty, limit }describe,notional,validate
Validation rules
- non-empty ticker
- qty ≠ 0
- limit > 0
This lab is your checkpoint before collections.
Challenge
Add OrderType field and include it in describe + validation.
Tips
- Lab code should compile and run
- Validate early at boundaries
- Structs + enums = domain model
Try it live
Module 3 Lab: Order TicketRust 2021
Loading editor…
Output
Press Run to compile and execute.