Skip to main content

ActionBehavior

Trait ActionBehavior 

Source
pub trait ActionBehavior {
    // Required method
    fn task(&mut self) -> Result<ActionTask>;

    // Provided methods
    fn reset(&mut self) { ... }
    fn on_running(&mut self) -> Result<()> { ... }
    fn on_success(&mut self) -> Result<()> { ... }
    fn on_failure(&mut self) -> Result<()> { ... }
    fn on_aborted(&mut self) -> Result<()> { ... }
}
Expand description

Behavior contract for user-defined action nodes.

Implementors define the ActionTask to execute when the action starts, and can react to task lifecycle updates through the provided hooks.

For more details, see the Action Lifecycle chapter in the book: https://beetry.pages.dev/runtime/action-lifecycle.html.

Required Methods§

Source

fn task(&mut self) -> Result<ActionTask>

Construct the task that should be scheduled for this action.

Provided Methods§

Source

fn reset(&mut self)

Reset action state.

Source

fn on_running(&mut self) -> Result<()>

Hook called on TaskStatus::Running.

Source

fn on_success(&mut self) -> Result<()>

Hook called on TaskStatus::Success.

Source

fn on_failure(&mut self) -> Result<()>

Hook called on TaskStatus::Failure

Source

fn on_aborted(&mut self) -> Result<()>

Hook called after the action is aborted.

Implementors§