pub struct Run { /* private fields */ }Expand description
A run of xmachines:workflow’s record protocol (the WIT run resource of
xmachines:workflow/runs), opened by Machine.open: a chunk at a time,
one call each, records out as JSON text. Callbacks run while the run is
borrowed, as of an Actor.
Implementations§
Source§impl Run
impl Run
Sourcepub fn opening(&self) -> Vec<String>
pub fn opening(&self) -> Vec<String>
The records the run opened with, each JSON text: the events the root
emitted as it started, then its snapshot, of seq 0; or the snapshot
of the checkpoint it reopened.
Sourcepub fn apply(&self, env: Env, chunk: String) -> Result<Vec<String>>
pub fn apply(&self, env: Env, chunk: String) -> Result<Vec<String>>
Applies one chunk (JSON text: an input, or a batch of them, all or
nothing) under the run’s next seq, and gives its records, each JSON
text: the events the machine emitted, then its snapshot; or one
rejection. A fault, the chunk’s terminal outcome, throws an error of
its code, message and seq: the run goes on after
WORKFLOW_INVALID_INPUT and WORKFLOW_INVALID_WORK_RESULT.
Sourcepub fn can(&self, env: Env, event: String) -> Result<bool>
pub fn can(&self, env: Env, event: String) -> Result<bool>
Whether the root would take event (JSON text) now: false of an
xstate. event, of one a guard throws on, and of text that is no
event. Changes nothing.
Sourcepub fn checkpoint(&self, env: Env) -> Result<String>
pub fn checkpoint(&self, env: Env) -> Result<String>
The run as a checkpoint now, { "seq", "snapshot" } as JSON text, its
snapshot with the engine’s state: what Machine.open reopens of, as
from.
Trait Implementations§
Source§impl FromNapiMutRef for Run
impl FromNapiMutRef for Run
Source§unsafe fn from_napi_mut_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static mut Self>
unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>
Source§impl FromNapiRef for Run
impl FromNapiRef for Run
Source§unsafe fn from_napi_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static Self>
unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>
Source§impl JavaScriptClassExt for Run
impl JavaScriptClassExt for Run
fn into_instance<'scope>( self, env: &'scope Env, ) -> Result<ClassInstance<'scope, Self>>
fn into_reference(self, env: Env) -> Result<Reference<Self>>
fn instance_of<'env, V: JsValue<'env>>(env: &Env, value: &V) -> Result<bool>
Source§impl ToNapiValue for Run
impl ToNapiValue for Run
Source§unsafe fn to_napi_value(env: napi_env, val: Run) -> Result<napi_value>
unsafe fn to_napi_value(env: napi_env, val: Run) -> Result<napi_value>
fn into_unknown(self, env: &Env) -> Result<Unknown<'_>, Error>
Source§impl TypeTag for Run
impl TypeTag for Run
Source§fn type_tag() -> napi_type_tag
fn type_tag() -> napi_type_tag
crate@version::module_path::ClassName),
which is fixed for a given class, so repeated calls return the same tag.