Skip to main content

Trace

Struct Trace 

Source
#[non_exhaustive]
pub struct Trace { pub initial: Context, pub steps: Vec<TraceStep>, pub truncated: bool, }
Expand description

A run’s trace: initial, then each step’s changes.

Written as {initial, steps, truncated}, and read back from what it writes: a trace read back writes the text it was read from, and replays to the original’s contexts.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§initial: Context

The context after the run’s stamps and the error context’s reset, before any workflow, redacted.

§steps: Vec<TraceStep>

Every step, in the order the run made them.

§truncated: bool

The byte budget was crossed: from the step that crossed it on, every step’s changes are empty, so the contexts replayed from there on are not whole.

Implementations§

Source§

impl Trace

Source

pub fn contexts(&self) -> impl Iterator<Item = Context> + '_

The context after each step, replaying the steps’ changes in order from initial: a removal removes its path; a change at a root merges its object’s keys into the root, unless it says replaced; anything else is set at its path as Path::set sets it, except that a root takes any value whole (a redacted root’s null, which Path::set refuses, included): a hop that cannot continue writes nothing, and a segment that is an index on an array names its element. A replay elsewhere, such as the UI’s, follows the same rules. Each context yielded is a whole copy.

Source

pub fn mapping_contexts(&self, step: usize) -> Option<Vec<Context>>

The context after each mapping of the map step at step, replaying initial through the steps before it and then the step’s changes up to each of its mapping_ends, by contexts’s rules: one context per mapping, in order, a mapping that wrote nothing repeating the one before it. The last is the context after the last mapping and before the step’s own trailing changes (the progress write, and the error context’s), so it differs from the context contexts yields for the step by those alone. None when step is past the last step, when the step has no mapping_ends, or when an end exceeds the step’s changes or precedes the end before it, as a trace edited or read from another build may have.

Source

pub fn validate(&self) -> Result<()>

Checks what a replay needs and a trace read from elsewhere may lack: every step’s mapping_ends fits its changes, every change’s path parses, and no change leaves a root anything but an object, or the null a redaction writes.

contexts and mapping_contexts trust their trace: a change that does not parse is skipped and a root written whole stands, as the splice and Ctx::set allow. A host that reads a trace from a caller (the wasm bindings do) calls this first and reports a failure as INVALID_TRACE.

§Errors

ErrorKind::Config naming the step and what is wrong.

Trait Implementations§

Source§

impl Clone for Trace

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Trace

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Trace

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Trace

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Trace

§

impl RefUnwindSafe for Trace

§

impl Send for Trace

§

impl Sync for Trace

§

impl Unpin for Trace

§

impl UnsafeUnpin for Trace

§

impl UnwindSafe for Trace

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.