Docs

trace

Source: crates/lvcs/src/runtime/trace.rs.

/// One sml logger callback (decision 286). Names are static in a running
/// machine and owned once decoded, so a recorded trace and a replayed one
/// compare equal when their names do.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub(crate) enum Line {
    /// An event entered processing: its generated variant name.
    #[serde(rename = "e")]
    Event(Cow<'static, str>),
    /// The state changed from the first to the second.
    #[serde(rename = "s")]
    State(Cow<'static, str>, Cow<'static, str>),
    /// A guard returned.
    #[serde(rename = "g")]
    Guard(Cow<'static, str>, bool),
    /// An action succeeded.
    #[serde(rename = "a")]
    Action(Cow<'static, str>),
}

/// The logger of every journaled machine: it records each callback until
/// the owner takes the trace after the step.
#[derive(Debug, Default)]
pub(crate) struct Trace {
    /// The callbacks since the last [`take`](Self::take).
    lines: Vec<Line>,
}

sml::sml_policies!(Journaled { logger: Trace });