Skip to main content

icedwright_trace/
lib.rs

1//! The icedwright trace format.
2//!
3//! A trace is a `.iwtrace` zip holding every step a test took:
4//!
5//! ```text
6//! meta.json          format, test, crate, versions, windows, theme, scale, failure, frames dropped
7//! steps.jsonl        one Step per line
8//! blobs/<hash>.yaml  semantic trees, each stored once
9//! blobs/<hash>.png   frames, each stored once
10//! source/<file>      the test source files steps point at
11//! real.json          real-clock timings, which comparisons skip
12//! ```
13//!
14//! [`TraceWriter`] takes plain values and writes the same bytes for the same steps on every
15//! run: instants are offsets from boot, ids are renumbered in order of first appearance, and
16//! the archive has fixed timestamps, member order and compression settings. When a trace would
17//! pass its size cap, frames are dropped in a fixed order; trees and steps never are.
18//! [`TraceReader`] reads it back, and [`compare`] finds where two traces first differ.
19
20#![forbid(unsafe_code)]
21#![deny(missing_docs)]
22
23mod archive;
24mod blob;
25mod budget;
26mod compare;
27mod config;
28mod error;
29mod ids;
30mod meta;
31mod normalise;
32mod reader;
33mod step;
34mod writer;
35
36pub use blob::{BadBlobHash, BlobHash, BlobRef, Media, Png, Yaml};
37pub use compare::{Difference, StepChange, StepDifference, compare};
38pub use config::{ByteSize, FramePolicy, TraceConfig, TraceMode};
39pub use error::TraceError;
40pub use ids::{
41    RawId, RawSubscriptionId, RawTaskId, RawWidgetId, RawWindowId, StepIndex, SubscriptionOrdinal,
42    TaskOrdinal, WidgetOrdinal, WindowOrdinal,
43};
44pub use meta::{FORMAT, TraceMeta, WindowMeta};
45pub use normalise::BootInstant;
46pub use reader::TraceReader;
47pub use step::{
48    Attempt, CanonicalSelector, Captured, RealSpan, RealTiming, RealTimings, SelectorText,
49    SourceLocation, Step, StepKind, StepOutcome, TraceEvent, TraceMessage, TraceOrigin, TraceTask,
50    TraceTaskChange,
51};
52pub use writer::{StepBuilder, TraceStart, TraceWriter, WriteSummary};
53
54#[cfg(test)]
55mod tests;