pub struct ExprArgs<'a, C, E> {
pub context: &'a C,
pub event: &'a Ev<E>,
pub params: Option<&'a Value>,
pub input: Option<&'a Value>,
/* private fields */
}Expand description
What an expression sees (XState’s evaluator scope): the context as the actions before it left it, the event, the params of the named JSON action or guard it is part of, and the active configuration.
Fields§
§context: &'a C§event: &'a Ev<E>§params: Option<&'a Value>The resolved params of the enclosing named action or guard defined
in the JSON (actions / guards at the root), if any.
input: Option<&'a Value>The state input (XState’s state input) of the state whose action,
output or invoke this is, or of a transition’s source state.
Implementations§
Source§impl<C: Serialize, E: EventType> ExprArgs<'_, C, E>
impl<C: Serialize, E: EventType> ExprArgs<'_, C, E>
Sourcepub fn scope_json(&self) -> Result<Value, String>
pub fn scope_json(&self) -> Result<Value, String>
XState’s evaluator scope as JSON, for evaluators in other runtimes:
{ "context", "event", "input"?, "params"?, "self", "parent"?, "children"? } (actor references as { "@actor", "incarnation" }).
Source§impl<C, E> ExprArgs<'_, C, E>
impl<C, E> ExprArgs<'_, C, E>
Sourcepub fn children(&self) -> &IndexMap<String, ActorRef, FixedState>
pub fn children(&self) -> &IndexMap<String, ActorRef, FixedState>
The actor’s children by id (XState’s children).
Sourcepub fn parent_ref(&self) -> Option<ActorRef>
pub fn parent_ref(&self) -> Option<ActorRef>
The actor’s parent (XState’s self._parent); None for the root.
Sourcepub fn fail(&self, message: impl Into<String>)
pub fn fail(&self, message: impl Into<String>)
Fails the step with message once the expression returns, as an
exception thrown by XState’s evaluator does (the first failure wins).