Rs
Module 8Data & TestingLesson 4 of 718 min

Data Shapes & Serde Mindset

Model ticks as structs; hand-parse CSV in playground.

Why serde

rust
// local world
#[derive(Serialize, Deserialize)]
struct Tick { ts: i64, symbol: String, bid: f64, ask: f64 }

Here

Parse by hand to learn the model and Result discipline.

Challenge

Reject ticks where ask < bid.

Tips
  • Validate at boundary
  • Wire format ≠ domain model always
  • serde offline

Try it live

Data Shapes & Serde MindsetRust 2021
Loading editor…
Output
Press Run to compile and execute.