pub struct Machine { /* private fields */ }Expand description
A definition compiled once with its load options and the callbacks of its
implementations (the WIT machine resource). Every actor started or
restored from it shares both; neither a start, a restore nor a refused
chunk compiles it again.
Implementations§
Source§impl Machine
impl Machine
Sourcepub fn load(
env: Env,
definition: String,
options: String,
implementations: Option<Object<'_>>,
) -> Result<Self>
pub fn load( env: Env, definition: String, options: String, implementations: Option<Object<'_>>, ) -> Result<Self>
Loads definition (MachineJSON) and compiles it, with its children,
once. Load options (JSON, all optional): { "children", "maxSteps", "maxTimers", "observeSystemEmitted", "hostActions": true | [name] }.
A load that fails throws an error whose code is the contract’s:
WORKFLOW_INVALID_MACHINE of a definition that does not compile,
WORKFLOW_INVALID_INPUT of options that do not parse.
Sourcepub fn start(&self, env: Env, options: String, now: f64) -> Result<Actor>
pub fn start(&self, env: Env, options: String, now: f64) -> Result<Actor>
Starts an actor at now, with { "input"?, "id"? }, its root’s id
root unless it names one. A start that fails throws an error whose
code is the contract’s: WORKFLOW_MACHINE_FAILED of a root that
failed as it started, WORKFLOW_INVALID_INPUT of options that do not
parse.
Trait Implementations§
Source§impl FromNapiMutRef for Machine
impl FromNapiMutRef for Machine
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 Machine
impl FromNapiRef for Machine
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 Machine
impl JavaScriptClassExt for Machine
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 Machine
impl ToNapiValue for Machine
Source§unsafe fn to_napi_value(env: napi_env, val: Machine) -> Result<napi_value>
unsafe fn to_napi_value(env: napi_env, val: Machine) -> Result<napi_value>
fn into_unknown(self, env: &Env) -> Result<Unknown<'_>, Error>
Source§impl TypeTag for Machine
impl TypeTag for Machine
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.