Skip to main content

Module session

Module session 

Source
Expand description

Sessions and the pure start and step functions (W3C SCXML Appendix D, interpret and mainEventLoop).

A Session is a value: the configuration as a bitset over states in document order, the history table, the internal queue, active invocations, the send and invoke counters, the late-binding status of data items and the options. start and step take a session (or create one) and an Input, and return the next session, the Effects to perform and a MacrostepTrace. They perform no I/O, read no clock and use no randomness; delays are durations inside effects and the time and seed of each input reach the datamodel only through Datamodel::set_environment.

The datamodel is the one mutable component kept outside the value (decision D1); it is passed as &mut dyn Datamodel. Executable content and condition evaluation live in this module and call it; the transition selection and entry/exit computations are delegated to the trait-object-free crate::kernel.

Structs§

Input
One input to step: an external event or a cancel request, plus its environment.
Invocation
A started invocation.
InvokeRequest
A request to start an invocation, produced at the end of a macrostep.
Options
Interpreter options, fixed at session start.
Outcome
The result of a macrostep.
SendRequest
A request to deliver an event, produced by <send>.
Session
The state of one session, as a value.
StartInput
The input that starts a session.

Enums§

Effect
An interaction with the outside world, returned by the step instead of performed.
InputKind
What an input asks the session to do.
StartError
Why a session could not start.
Status
Whether the session still accepts events.
StepError
Why a step was rejected or cut short.

Constants§

COMMUNICATION_ERROR_MESSAGE
Message of an error.communication for a target the core knows is unreachable.
DEFAULT_MICROSTEP_BUDGET
The default number of microsteps one macrostep may take before it is cut off.
EXECUTION_ERROR_MESSAGE
Message of an error.execution the core raises itself, not from a datamodel failure.
SCXML_EVENT_PROCESSOR
The type URI of the SCXML Event I/O Processor.
SCXML_INVOKE_TYPE
The type URI of SCXML invocations.

Functions§

parse_delay
Parse a CSS2 time (5s, 250ms, 1.5s, or a bare number of milliseconds) into milliseconds, without floating point.
start
Start a session: initialize the datamodel (all data under early binding, top-level data under late binding), run the top-level script, enter the initial configuration and run macrosteps until stable. dm must be a fresh instance of the datamodel the chart names.
step
Process one input: run one macrostep for an external event, or terminate on a cancel request. Equal sessions, inputs and datamodel states give equal results.