Skip to main content

NodeActor

Struct NodeActor 

Source
pub struct NodeActor<T: TypedMachine> { /* private fields */ }
Expand description

The actor behind an addon’s Actor class: a JsonActor with the JavaScript side’s numbers and errors, retired by a panic.

Implementations§

Source§

impl<T: TypedMachine> NodeActor<T>

Source

pub fn start(options: &str, now: f64) -> Result<Self>

Starts an actor at now with the options of JsonActor::start.

Source

pub fn restore(options: &str, snapshot: &str) -> Result<Self>

Restores an actor from persist output with the options of JsonActor::restore. Runs no actions.

Source

pub fn send(&mut self, event: &str, now: f64) -> Result<()>

Sends an event of the machine to the root at now (JsonActor::send).

Source

pub fn send_to(&mut self, address: &str, event: &str, now: f64) -> Result<()>

Sends an event to any actor in the system by address (JsonActor::send_to).

Source

pub fn advance(&mut self, now: f64) -> Result<()>

Fires every timer due at or before now.

Source

pub fn next_deadline(&self) -> Result<Option<f64>>

When the next timer is due, in milliseconds.

Source

pub fn snapshot(&self) -> Result<String>

The root’s snapshot (JsonActor::snapshot).

Source

pub fn persist(&self) -> Result<String>

The whole system, for restore.

Source

pub fn take_emitted(&mut self) -> Result<Vec<String>>

Events the root emitted since the last call, oldest first.

Source

pub fn observe_system_emitted(&mut self) -> Result<()>

Collects the events every actor in the system emits from now on.

Source

pub fn unobserve_system_emitted(&mut self) -> Result<()>

Stops collecting them and drops those not taken.

Source

pub fn take_system_emitted(&mut self) -> Result<Vec<String>>

Events every actor emitted since the last call (JsonActor::take_system_emitted).

Source

pub fn take_logs(&mut self) -> Result<Vec<String>>

Argument lists of the root’s @xstate.log actions since the last call.

Source

pub fn pending_effects(&self) -> Result<Vec<String>>

External work waiting for the host (XState’s external effect data).

Source

pub fn resolve_effect(&mut self, id: &str, event: Option<&str>) -> Result<()>

Completes a pending effect, optionally with a result event.

Source

pub fn stop(&mut self) -> Result<()>

Stops the root and its children.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for NodeActor<T>

§

impl<T> !Sync for NodeActor<T>

§

impl<T> !UnwindSafe for NodeActor<T>

§

impl<T> Forget for NodeActor<T>

§

impl<T> Freeze for NodeActor<T>

§

impl<T> Move for NodeActor<T>

§

impl<T> Send for NodeActor<T>

§

impl<T> Unpin for NodeActor<T>

§

impl<T> UnsafeUnpin for NodeActor<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.