Rs
Module 3Result & LabLesson 9 of 925 min

Module 3 Lab: Order Ticket

Combine Side, Order, describe, notional, and validate.

Build this ticket model

  1. enum Side { Buy, Sell }
  2. struct Order { side, ticker, qty, limit }
  3. 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.