Module std.machine.history

Retain selected compound subtrees alongside an ordinary machine value.

Saved subtrees are independent values. Restore them explicitly in a computed transition, supplying fresh payload for their enclosing states.

Contents

Functions

Function track

pub fn track<M: Machine>(initial: M, requested: Vec<M.Scope>) -> Owner<M>

Start tracking departures from the requested compound scopes.

Types

Struct Owner

Fields

current: M
requested: Vec<M.Scope>
entries: Vec<MachineDeparture<M.Scope, M.Subtree>>

Inherent methods

impl<M: Machine> Owner<M> where M.Scope: Eq

fn state(self) -> M

Return an independent copy of the current machine.

fn saved(self, target: M.Scope) -> Option<M.Subtree>

Return the most recently departed subtree for this scope, if any.

fn step(var self, event: M.Event, limit: i64 = 1024) -> Result<M.Step, MachineStepError>

Commit the machine and saved subtrees together after a successful step.