Scientific learning path

Train for the Tsuru Rust sample like a systems lab.

This is not a reading list. It is a retrieval-first, build-heavy learning system for Rust, binary parsing, packet formats, streaming reorder, market-data semantics, and performance discipline.

Target executable

Build a command-line parser that reads PCAP, extracts UDP quote payloads, parses market-data messages, optionally reorders within a 3-second window, and prints deterministic output.

PCAP->Ethernet->IPv4->UDP->Quote->Reorder

Next 90 minutes

  1. 1. Write what you remember about borrowed slices.
  2. 2. Build Lab 1 without opening docs for 20 minutes.
  3. 3. Read only the missing Rust Book sections.
  4. 4. Add three malformed-input tests.
  5. 5. Explain why the parser never panics.
Start labs

Learning Loop

Each topic follows the same cognitive loop: recall first, read narrowly, build, break, measure, then explain.

1

Retrieve

Answer from memory before opening docs. Failed recall marks what to study.

2

Read narrow

Read only the slice needed for the next lab. No broad quant detours.

3

Build

Implement from bytes, errors, and tests. Prefer checked slicing over clever casts.

4

Break

Feed short packets, bad lengths, endian mistakes, and reordering edge cases.

5

Profile

After correctness, measure allocations and hot loops. Optimize measured paths.

6

Explain

Write one paragraph explaining the invariant, tradeoff, and failure mode.

Skill Map

The path is ordered by dependency, but practice stays interleaved: every phase includes correctness, malformed inputs, and explanation.

Days 1-7A fixed-width ASCII parser over &[u8] with no String allocation on the hot path.

Rust control of memory

Ownership is not syntax trivia; it is how packet bytes stay borrowed, bounded, and cheap.

Retrieval check

Explain why returning a borrowed field from a parser needs an input lifetime.

Common trap

Cloning into String to escape borrow errors.

Days 8-10parse-quote [-r] input.pcap skeleton with structured errors and golden CLI tests.

CLI and byte I/O

A market-data exercise is still a Unix tool: args, files, stdout, stderr, exit codes.

Retrieval check

Describe when BufReader helps and when reading one packet at a time still matters.

Common trap

Panicking on bad input instead of returning an actionable parse error.

Days 11-18PCAP -> Ethernet -> IPv4 -> UDP payload iterator with malformed packet tests.

Packet dissection

Headers are contracts. Every length, endian field, and offset must be checked before use.

Retrieval check

From memory: list fields needed to find the UDP payload inside IPv4.

Common trap

Assuming fixed IPv4 header length and ignoring IHL.

Days 19-23Quote-message parser plus stdout renderer matching the sample contract.

Quote semantics

Parsing bytes is not enough; the output must preserve timestamp, symbol, side, price, size, and order.

Retrieval check

Explain which fields are transport metadata and which fields are market data.

Common trap

Formatting early and losing numeric structure before tests can inspect it.

Days 24-30BinaryHeap reorder window that emits safe packets and flushes at EOF.

Streaming reorder

The 3-second buffer is a streaming algorithm, not a sort. Memory and latency are bounded.

Retrieval check

State the heap invariant and the condition that makes an item safe to emit.

Common trap

Collecting the whole input before sorting.

After first passCriterion benchmark, flamegraph note, and allocation reduction patch.

Performance discipline

Performance work starts after correctness and names the metric it moved.

Retrieval check

Name the exact benchmark, baseline, change, and result.

Common trap

Replacing readable code with clever code before profiling.

Diagnostic Router

Use symptoms, not vibes. Pick the route matching the thing that fails first.

Borrow checker fights every parser function.

Start with Lab 1 and explain lifetimes before reading packet docs.

Packet offsets feel like magic numbers.

Do Lab 2 and Lab 3 with one-byte truncation tests at every boundary.

Reorder sounds like sorting.

Skip broad algorithms. Learn heap invariant, then implement Lab 5.

Performance work becomes guessing.

Delay optimization until Lab 6: benchmark, profile, change one hot path.

Choose Work Surface

Measure first, optimize only the hot path.