pub struct TraceWriter { /* private fields */ }Expand description
Builds a trace step by step and writes the archive. It takes plain values and knows nothing
about iced; the harness’s step observer drives it. A step is open between
begin_step and StepBuilder::end.
Implementations§
Source§impl TraceWriter
impl TraceWriter
Sourcepub fn new(meta: TraceMeta, config: &TraceConfig, start: TraceStart) -> Self
pub fn new(meta: TraceMeta, config: &TraceConfig, start: TraceStart) -> Self
A writer for one test, starting from what the app showed at boot.
Sourcepub fn begin_step(
&mut self,
kind: StepKind,
location: SourceLocation,
at: VirtualDuration,
) -> StepBuilder<'_>
pub fn begin_step( &mut self, kind: StepKind, location: SourceLocation, at: VirtualDuration, ) -> StepBuilder<'_>
Opens a step that began at at, measured from boot.
Sourcepub fn ordinal<I: RawId>(&mut self, raw: I) -> I::Ordinal
pub fn ordinal<I: RawId>(&mut self, raw: I) -> I::Ordinal
Renumbers a raw id to a per-trace ordinal, in order of first appearance. The ordinal’s type follows from the raw id’s.
Sourcepub fn last_step(&self) -> Option<&Step>
pub fn last_step(&self) -> Option<&Step>
The step most recently ended, as the archive will hold it, for streaming a trace while it is recorded.
Sourcepub fn meta_mut(&mut self) -> &mut TraceMeta
pub fn meta_mut(&mut self) -> &mut TraceMeta
The metadata, for filling in what is known only later, such as the failure message.
Sourcepub fn wall_clock_start(&mut self, started: SystemTime)
pub fn wall_clock_start(&mut self, started: SystemTime)
Records the wall-clock time the test started, which goes in real.json only.
Sourcepub fn referenced_sources(&self) -> BTreeSet<&str>
pub fn referenced_sources(&self) -> BTreeSet<&str>
Every source file a step’s location names, so the caller can add each one.
Sourcepub fn add_source(&mut self, file: &str, text: String) -> Result<(), TraceError>
pub fn add_source(&mut self, file: &str, text: String) -> Result<(), TraceError>
Stores the text of a source file under source/, so the trace can show the line of a
step without a checkout.
Sourcepub fn frames_dropped(&self) -> u32
pub fn frames_dropped(&self) -> u32
How many frames have been dropped so far to keep memory under the size cap.
Sourcepub fn write(self, sink: &mut impl Write) -> Result<WriteSummary, TraceError>
pub fn write(self, sink: &mut impl Write) -> Result<WriteSummary, TraceError>
Writes the archive to sink. When it would pass the size cap, frames are dropped in
the documented order until it fits; trees and steps are never dropped.