pub struct WorkflowHost { /* private fields */ }Expand description
A parsed, validated and compiled workflow. Assembly is the only constructor, so a long-running host cannot accidentally skip static validation.
Implementations§
Source§impl WorkflowHost
impl WorkflowHost
Sourcepub fn assemble(
spec_json: &str,
registry: &NodeRegistry,
) -> Result<Self, HostError>
pub fn assemble( spec_json: &str, registry: &NodeRegistry, ) -> Result<Self, HostError>
Parse, validate and compile a spec from JSON.
Sourcepub fn from_spec(
spec: &Spec,
registry: &NodeRegistry,
) -> Result<Self, HostError>
pub fn from_spec( spec: &Spec, registry: &NodeRegistry, ) -> Result<Self, HostError>
Validate and compile every branch of spec.
Sourcepub fn branch_ids(&self) -> impl Iterator<Item = &str>
pub fn branch_ids(&self) -> impl Iterator<Item = &str>
Every branch id.
Sourcepub fn branch_count(&self) -> usize
pub fn branch_count(&self) -> usize
Number of branches.
Sourcepub fn context(&self, state: Arc<dyn State>) -> WorkflowContext
pub fn context(&self, state: Arc<dyn State>) -> WorkflowContext
Context for the root branch over state.
Sourcepub fn context_for(
&self,
branch_id: &str,
state: Arc<dyn State>,
) -> WorkflowContext
pub fn context_for( &self, branch_id: &str, state: Arc<dyn State>, ) -> WorkflowContext
Context for branch_id over state.
Sourcepub async fn run_event(
&self,
ctx: &WorkflowContext,
event: Event,
) -> Option<RunOutcome>
pub async fn run_event( &self, ctx: &WorkflowContext, event: Event, ) -> Option<RunOutcome>
Drive one event through the context’s branch.
Sourcepub async fn run_event_on(
&self,
branch_id: &str,
ctx: &WorkflowContext,
event: Event,
) -> Option<RunOutcome>
pub async fn run_event_on( &self, branch_id: &str, ctx: &WorkflowContext, event: Event, ) -> Option<RunOutcome>
Drive one event through branch_id; None when the branch does not exist.
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowHost
impl !UnwindSafe for WorkflowHost
impl Freeze for WorkflowHost
impl Send for WorkflowHost
impl Sync for WorkflowHost
impl Unpin for WorkflowHost
impl UnsafeUnpin for WorkflowHost
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