pub struct WorkflowVm { /* private fields */ }Expand description
Executes Workflow scripts, one isolated QuickJS runtime per run.
Every WorkflowVm::run_script call spins up a fresh interpreter on a
dedicated thread, so runs share nothing (globals, heap, interned atoms)
and a wedged script can never stall a sibling run.
Implementations§
Source§impl WorkflowVm
impl WorkflowVm
Sourcepub fn with_limits(limits: VmLimits) -> Self
pub fn with_limits(limits: VmLimits) -> Self
A VM with explicit resource limits.
Sourcepub async fn run_script(
&self,
source: &str,
args: Value,
driver: Arc<dyn WorkflowDriver>,
) -> Result<Value, WorkflowJsError>
pub async fn run_script( &self, source: &str, args: Value, driver: Arc<dyn WorkflowDriver>, ) -> Result<Value, WorkflowJsError>
Run one Workflow script to completion.
sourceis the script body; it is wrapped in an async function, so top-levelawaitandreturnboth work. The returned value is the script’sreturnvalue, JSON-encoded (undefinedbecomesnull).argsis exposed verbatim to the script as theargsglobal.driverexecutestask()spawns and receives progress events. A driver instance is scoped to exactly one run:cancel_allis always invoked at run teardown (success, script error, or cancellation), so stray children never outlive the script that spawned them.
Cancellation cascade (design §9): dropping the returned future cancels
the run — the interrupt handler aborts executing JS, pending task()
awaits resolve to errors, and driver.cancel_all() is invoked
immediately from the dropping thread.
Trait Implementations§
Source§impl Clone for WorkflowVm
impl Clone for WorkflowVm
Source§fn clone(&self) -> WorkflowVm
fn clone(&self) -> WorkflowVm
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorkflowVm
impl Debug for WorkflowVm
Source§impl Default for WorkflowVm
impl Default for WorkflowVm
Source§fn default() -> WorkflowVm
fn default() -> WorkflowVm
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WorkflowVm
impl RefUnwindSafe for WorkflowVm
impl Send for WorkflowVm
impl Sync for WorkflowVm
impl Unpin for WorkflowVm
impl UnsafeUnpin for WorkflowVm
impl UnwindSafe for WorkflowVm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more