Expand description
Reading a trace bundle (issue #87).
The reader assumes nothing finished cleanly. A run that was killed leaves a
bundle with no manifest and a half-written last line; that bundle still
holds the evidence someone is looking for, so it is repaired on open rather
than rejected. This mirrors js/src/traces/reader.js and
python/src/browser_commander/traces/reader.py, down to the messages, so a
bundle reads the same whichever language opens it.
§Example
use browser_commander::traces::{diff_control_state, read_trace};
let trace = read_trace("./traces/run")?;
println!("{} events", trace.events.len());
let before = trace.state(1)?;
let after = trace.state(2)?;
for change in diff_control_state(before.as_ref(), after.as_ref()) {
println!("{} {}", change.change.as_str(), change.path.unwrap_or_default());
}Structs§
- Control
Change - One control that differs between two checkpoints.
- Parsed
Ndjson - What an NDJSON file held, and whether it ended mid-line.
- Trace
- An opened trace bundle.
- Trace
Checkpoint - One named moment, as the timeline describes it.
Enums§
- Control
Change Kind - Which way a control went between two checkpoints.
- Trace
Error - Everything that can stop a bundle from being read.
Functions§
- diff_
control_ state - Diff two checkpoints’ control state.
- parse_
ndjson - Parse an NDJSON body, keeping everything before the first unreadable line.
- read_
trace - Open a trace bundle.