Trait LifecycleNode

Source
pub trait LifecycleNode<Context, Action>: Send + Sync
where Context: Send + Sync + 'static, Action: ActionType + Send + Sync + 'static, Self::PrepOutput: Clone + Send + Sync + 'static, Self::ExecOutput: Clone + Send + Sync + 'static,
{ type PrepOutput; type ExecOutput; // Required methods fn id(&self) -> NodeId; fn prep<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 mut Context, ) -> Pin<Box<dyn Future<Output = Result<Self::PrepOutput, FloxideError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn exec<'life0, 'async_trait>( &'life0 self, prep_result: Self::PrepOutput, ) -> Pin<Box<dyn Future<Output = Result<Self::ExecOutput, FloxideError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn post<'life0, 'life1, 'async_trait>( &'life0 self, prep_result: Self::PrepOutput, exec_result: Self::ExecOutput, ctx: &'life1 mut Context, ) -> Pin<Box<dyn Future<Output = Result<Action, FloxideError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; }
Expand description

A node that implements the prep/exec/post lifecycle

Required Associated Types§

Source

type PrepOutput

Output type from the preparation phase

Source

type ExecOutput

Output type from the execution phase

Required Methods§

Source

fn id(&self) -> NodeId

Get the node’s unique identifier

Source

fn prep<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 mut Context, ) -> Pin<Box<dyn Future<Output = Result<Self::PrepOutput, FloxideError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Preparation phase - perform setup and validation

Source

fn exec<'life0, 'async_trait>( &'life0 self, prep_result: Self::PrepOutput, ) -> Pin<Box<dyn Future<Output = Result<Self::ExecOutput, FloxideError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execution phase - perform the main work

Source

fn post<'life0, 'life1, 'async_trait>( &'life0 self, prep_result: Self::PrepOutput, exec_result: Self::ExecOutput, ctx: &'life1 mut Context, ) -> Pin<Box<dyn Future<Output = Result<Action, FloxideError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Post-execution phase - determine the next action and update context

Implementors§