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§
Sourcefn task(&mut self) -> Result<ActionTask>
fn task(&mut self) -> Result<ActionTask>
Construct the task that should be scheduled for this action.
Provided Methods§
Sourcefn on_running(&mut self) -> Result<()>
fn on_running(&mut self) -> Result<()>
Hook called on TaskStatus::Running.
Sourcefn on_success(&mut self) -> Result<()>
fn on_success(&mut self) -> Result<()>
Hook called on TaskStatus::Success.
Sourcefn on_failure(&mut self) -> Result<()>
fn on_failure(&mut self) -> Result<()>
Hook called on TaskStatus::Failure
Sourcefn on_aborted(&mut self) -> Result<()>
fn on_aborted(&mut self) -> Result<()>
Hook called after the action is aborted.