pub trait WorkflowDriver: Send + Sync {
// Required methods
fn spawn_task<'life0, 'async_trait>(
&'life0 self,
request: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<SpawnedTask, DriverError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn cancel_all(&self);
fn budget(&self) -> BudgetSnapshot;
fn progress(&self, event: ProgressEvent);
}Expand description
Host-side executor for a Workflow run.
Implementations must be cheap to call from the VM thread: spawn_task
admits the task and returns immediately (fire-and-forget spawn — never
await the child inline), while budget, progress, and cancel_all are
synchronous. cancel_all must be idempotent; it is invoked when the
script errors, when the run future is dropped, and once more never hurts.
Required Methods§
Sourcefn spawn_task<'life0, 'async_trait>(
&'life0 self,
request: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<SpawnedTask, DriverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn_task<'life0, 'async_trait>(
&'life0 self,
request: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<SpawnedTask, DriverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Admit and start one task. Errors surface as a JS throw on the
corresponding task() call.
Sourcefn cancel_all(&self)
fn cancel_all(&self)
Cancel every in-flight task belonging to this run. Idempotent.
Sourcefn budget(&self) -> BudgetSnapshot
fn budget(&self) -> BudgetSnapshot
Current snapshot of the run’s shared token pool.
Sourcefn progress(&self, event: ProgressEvent)
fn progress(&self, event: ProgressEvent)
Receive a script progress event (ordered, synchronous).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".