#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.initial: ContextThe 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: boolThe 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
impl Trace
Sourcepub fn contexts(&self) -> impl Iterator<Item = Context> + '_
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.
Sourcepub fn mapping_contexts(&self, step: usize) -> Option<Vec<Context>>
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.
Sourcepub fn validate(&self) -> Result<()>
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.