pub trait LifecycleNode<Context, Action>: Send + Syncwhere
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§
Sourcetype PrepOutput
type PrepOutput
Output type from the preparation phase
Sourcetype ExecOutput
type ExecOutput
Output type from the execution phase
Required Methods§
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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,
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