Module std.machine.watch

Bounded, lag-visible observation of an explicitly owned machine.

Stepping calls the machine's ordinary evaluator. Subscribers independently read committed notices; outputs remain owned by the caller of step.

Contents

Functions

Function observe

pub fn observe<M: Machine + Send>(initial: M, capacity: i64, subscribers: i64) -> Result<(Owner<M.Event, M.Step>, Feed<M>), string> where M.Event: Send, M.Step: Send

Create an independent observed copy, with bounded history and subscribers.

Types

Struct Snapshot

Fields

state: M
revision: i64

Struct Notice

Fields

state: M
revision: i64
transition: MachineStepInfo

Struct Lag

Fields

last_seen: i64
available_from: i64

Enum SubscribeError

Variants

Closed
Limit
Exhausted

Struct Owner

Fields

drive: fn(E) -> R

Struct Feed

Fields

subscribe_to: fn() -> Result<Subscription<M>, SubscribeError>

Struct Subscription

Fields

snapshot: Snapshot<M>
receive_notice: fn() -> Result<Option<Notice<M>>, Lag>