Skip to main content

JsonMachine

Struct JsonMachine 

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

The compiled machine of a TypedMachine with its load options, as the typed world’s machine resource holds it: every actor started or restored from it shares both.

Implementations§

Source§

impl<T: TypedMachine> JsonMachine<T>

Source

pub fn load(options: &str) -> Result<Self, String>

The compiled machine with load options (JSON, all optional): { "maxSteps": number, "maxTimers": number, "observeSystemEmitted": bool }. A typed machine compiles its children and actions in, so it takes no children or hostActions. An error is the contract’s { "code", "message" }: options that do not parse are WORKFLOW_INVALID_INPUT, and a machine that does not compile WORKFLOW_INVALID_MACHINE.

Source

pub fn start(&self, options: &str, now: u64) -> Result<JsonActor<T>, String>

Starts an actor at now, with { "input"?, "id"? }, its root’s id root unless it names one. An error is the contract’s { "code", "message" } (LoadOptions::start_json): a start whose root fails is WORKFLOW_MACHINE_FAILED, and no actor.

Source

pub fn restore(&self, snapshot: &str) -> Result<JsonActor<T>, String>

Restores an actor from JsonActor::persist output: its input and id are in the snapshot, the rest is the machine’s. Runs no actions. An error is the contract’s { "code", "message" } (LoadOptions::restore_json): a snapshot that does not restore is WORKFLOW_INVALID_SNAPSHOT.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for JsonMachine<T>

§

impl<T> !UnwindSafe for JsonMachine<T>

§

impl<T> Forget for JsonMachine<T>

§

impl<T> Freeze for JsonMachine<T>

§

impl<T> Move for JsonMachine<T>

§

impl<T> Send for JsonMachine<T>
where Arc<Machine<<T as TypedMachine>::Context, <T as TypedMachine>::Event>>: Send, RawTable<usize>: Send, RawVecInner: Send,

§

impl<T> Sync for JsonMachine<T>
where Arc<Machine<<T as TypedMachine>::Context, <T as TypedMachine>::Event>>: Sync, RawTable<usize>: Sync, RawVecInner: Sync,

§

impl<T> Unpin for JsonMachine<T>
where Arc<Machine<<T as TypedMachine>::Context, <T as TypedMachine>::Event>>: Unpin, *const u8 is !null: Unpin,

§

impl<T> UnsafeUnpin for JsonMachine<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.