Skip to main content

Node

Trait Node 

Source
pub trait Node {
    // Required method
    fn tick(&mut self) -> TickStatus;

    // Provided methods
    fn reset(&mut self) { ... }
    fn abort(&mut self) { ... }
}
Expand description

Runtime contract for executable behavior tree nodes.

Implementations should keep all methods non-blocking. If a node blocks inside it can stall tree progress and leave execution stuck until that call returns.

Required Methods§

Source

fn tick(&mut self) -> TickStatus

Advance the node by one execution step.

Returning TickStatus::Running indicates the node is still in progress. Returning TickStatus::Success or TickStatus::Failure indicates the node has reached a terminal state for the current run.

Provided Methods§

Source

fn reset(&mut self)

Reset given node to its default state:

  • should only be called by the behavior tree (root)
  • should not block the thread and ideally be finished during single tick
Source

fn abort(&mut self)

Interface to abort/cancel running tasks. Signal is generated by scheduling (non-leaf) nodes and propagated to children. If leaf node’s task is running in an executor an abort signal is sent.

Implementors§

Source§

impl Node for BoxNode

Source§

impl<B> Node for Condition<B>
where B: Behavior,

Source§

impl<N> Node for Root<N>
where N: Node,

Source§

impl<N> Node for Tree<N>
where N: Node,

Source§

impl<R, TH, B> Node for Action<R, TH, B>
where R: RegisterTask<TH>, TH: TaskHandle, B: Behavior,