Skip to main content

TraceWriter

Struct TraceWriter 

Source
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

Source

pub fn new(meta: TraceMeta, config: &TraceConfig, start: TraceStart) -> Self

A writer for one test, starting from what the app showed at boot.

Source

pub fn begin_step( &mut self, kind: StepKind, location: SourceLocation, at: VirtualDuration, ) -> StepBuilder<'_>

Opens a step that began at at, measured from boot.

Source

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.

Source

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.

Source

pub fn meta_mut(&mut self) -> &mut TraceMeta

The metadata, for filling in what is known only later, such as the failure message.

Source

pub fn wall_clock_start(&mut self, started: SystemTime)

Records the wall-clock time the test started, which goes in real.json only.

Source

pub fn referenced_sources(&self) -> BTreeSet<&str>

Every source file a step’s location names, so the caller can add each one.

Source

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.

Source

pub fn attach(&mut self, name: &str, bytes: Vec<u8>) -> Result<(), TraceError>

Stores a file the test attached under attachments/. name is a plain file name; a second attachment with the same name replaces the first. Attachments are never dropped to fit the size cap.

Source

pub fn frames_dropped(&self) -> u32

How many frames have been dropped so far to keep memory under the size cap.

Source

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.

Trait Implementations§

Source§

impl Debug for TraceWriter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for TraceWriter

§

impl Freeze for TraceWriter
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<WindowMeta>: Freeze, *const LeafNode<u64, u32> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(u64, u32)>>: Freeze, PhantomData<Entry>: Freeze, PhantomData<RealTiming>: Freeze, *const LeafNode<BlobHash, String> is !null: Freeze, PhantomData<Box<(BlobHash, String)>>: Freeze, *const LeafNode<BlobHash, Png> is !null: Freeze, PhantomData<Box<(BlobHash, Png)>>: Freeze, *const LeafNode<BlobHash, usize> is !null: Freeze, PhantomData<Box<(BlobHash, usize)>>: Freeze, PhantomData<fn() -> Yaml>: Freeze, *const LeafNode<Producer, SetValZST> is !null: Freeze, PhantomData<Box<(Producer, SetValZST)>>: Freeze, *const LeafNode<String, String> is !null: Freeze, PhantomData<Box<(String, String)>>: Freeze, *const LeafNode<String, Vec<u8>> is !null: Freeze, PhantomData<Box<(String, Vec<u8>)>>: Freeze,

§

impl Move for TraceWriter

§

impl RefUnwindSafe for TraceWriter

§

impl Send for TraceWriter
where RawVecInner: Send, NodeRef<Owned, u64, u32, LeafOrInternal>: Send, BoxRaw<(u64, u32)>: Send, &'static str: Send, String: Send, NodeRef<Owned, BlobHash, String, LeafOrInternal>: Send, BoxRaw<(BlobHash, String)>: Send, NodeRef<Owned, BlobHash, Png, LeafOrInternal>: Send, BoxRaw<(BlobHash, Png)>: Send, NodeRef<Owned, BlobHash, usize, LeafOrInternal>: Send, BoxRaw<(BlobHash, usize)>: Send, NodeRef<Owned, Producer, SetValZST, LeafOrInternal>: Send, BoxRaw<(Producer, SetValZST)>: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, String, Vec<u8>, LeafOrInternal>: Send, BoxRaw<(String, Vec<u8>)>: Send,

§

impl Sync for TraceWriter
where RawVecInner: Sync, NodeRef<Owned, u64, u32, LeafOrInternal>: Sync, BoxRaw<(u64, u32)>: Sync, String: Sync, NodeRef<Owned, BlobHash, String, LeafOrInternal>: Sync, BoxRaw<(BlobHash, String)>: Sync, NodeRef<Owned, BlobHash, Png, LeafOrInternal>: Sync, BoxRaw<(BlobHash, Png)>: Sync, NodeRef<Owned, BlobHash, usize, LeafOrInternal>: Sync, BoxRaw<(BlobHash, usize)>: Sync, NodeRef<Owned, Producer, SetValZST, LeafOrInternal>: Sync, BoxRaw<(Producer, SetValZST)>: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, String, Vec<u8>, LeafOrInternal>: Sync, BoxRaw<(String, Vec<u8>)>: Sync,

§

impl Unpin for TraceWriter
where *const u8 is !null: Unpin, *const LeafNode<u64, u32> is !null: Unpin, Box<(u64, u32)>: Unpin, &'static str: Unpin, String: Unpin, *const LeafNode<BlobHash, String> is !null: Unpin, Box<(BlobHash, String)>: Unpin, *const LeafNode<BlobHash, Png> is !null: Unpin, Box<(BlobHash, Png)>: Unpin, *const LeafNode<BlobHash, usize> is !null: Unpin, Box<(BlobHash, usize)>: Unpin, *const LeafNode<Producer, SetValZST> is !null: Unpin, Box<(Producer, SetValZST)>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *const LeafNode<String, Vec<u8>> is !null: Unpin, Box<(String, Vec<u8>)>: Unpin,

§

impl UnsafeUnpin for TraceWriter

§

impl UnwindSafe for TraceWriter

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.