Action

Trait Action 

Source
pub trait Action: Send + Sync {
    // Required methods
    fn run<'life0, 'async_trait>(
        &'life0 self,
        runtime: Runtime,
        operation: Operation,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ActionOutput>, ActionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn probe<'life0, 'async_trait>(
        &'life0 self,
        runtime: Runtime,
    ) -> Pin<Box<dyn Future<Output = Result<Probe, ActionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn display_name(&self) -> String;

    // Provided method
    fn load_state<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _builder: &'life1 mut RuntimeBuilder,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

A measurable, reversible task.

Any Action can test its environment to see if it needs to run at all, and can undo any changes it has made. Any Action can also depend on other Actions, and the engine will ensure that all dependencies are run before the Action itself.

Required Methods§

Source

fn run<'life0, 'async_trait>( &'life0 self, runtime: Runtime, operation: Operation, ) -> Pin<Box<dyn Future<Output = Result<Option<ActionOutput>, ActionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run the action.

This method takes a Runtime object, which contains the context for the action. It also takes an Operation, which is used to determine what the action should do.

Source

fn probe<'life0, 'async_trait>( &'life0 self, runtime: Runtime, ) -> Pin<Box<dyn Future<Output = Result<Probe, ActionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Probe the action for specific information.

Source

fn display_name(&self) -> String

Get the display name of the action.

Provided Methods§

Source

fn load_state<'life0, 'life1, 'async_trait>( &'life0 self, _builder: &'life1 mut RuntimeBuilder, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load required state.

Implementors§