Docs

replay

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

/// Where a replayed entry first differed from the journal.
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct Divergence {
    /// Zero-based index of the entry among those replayed.
    pub(crate) index: u64,
    /// What differed: `trace`, `state_before`, or `state_after`.
    pub(crate) what: &'static str,
    /// What the journal recorded.
    pub(crate) expected: String,
    /// What the replayed machine did.
    pub(crate) actual: String,
}

/// Replay `entries` into `machine`, returning the outputs it produced
/// (recorded, never executed) and the first divergence, at which it stops.
pub(crate) fn replay<M, E, O, C, I>(
    machine: &mut M,
    hooks: &Hooks<M, O, C>,
    entries: I,
) -> (Vec<O>, Option<Divergence>)
where
    M: sml::Machine<E>,
    C: PartialEq + Debug,
    I: IntoIterator<Item = JournalEntry<E, C>>,