BehaviorTree

Struct BehaviorTree 

Source
pub struct BehaviorTree { /* private fields */ }
Expand description

A Tree of BehaviorTreeElements. A certain BehaviorTree can contain up to 65536 BehaviorTreeElements.

Implementations§

Source§

impl BehaviorTree

Source

pub fn new(root: BehaviorTreeElement, registry: &BehaviorRegistry) -> Self

create a Tree with reference to its libraries

Source

pub const fn blackboard(&self) -> &Databoard

Access the root blackboard of the tree.

Source

pub fn print(&self) -> Result<(), Error>

Pretty print the tree.

§Errors
  • if tree depth exceeds 127 (sub)tree levels.
Source

pub fn subtree(&self, index: usize) -> Result<&BehaviorTreeElement, Error>

Get a (sub)tree where index 0 is root tree.

§Errors
  • if subtree is not found.
Source

pub const fn uuid(&self) -> Uuid

Get the trees uuid.

Source

pub fn sender(&self) -> Sender<BehaviorTreeMessage>

Get a message sender. This sender can be used to modify the tree while running.

Source

pub fn size(&self) -> u16

Get the trees total number of children.

Source

pub async fn tick_exactly_once(&mut self) -> BehaviorResult

Ticks the tree exactly once.

§Errors
Source

pub async fn tick_once(&mut self) -> BehaviorResult

Ticks the tree once. @TODO: The wakeup mechanism is not yet implemented

§Errors
Source

pub async fn tick_while_running(&mut self) -> BehaviorResult

Ticks the tree until it finishes either with BehaviorState::Success or BehaviorState::Failure.

§Errors
Source

pub fn iter(&self) -> impl Iterator<Item = &BehaviorTreeElement>

Get an iterator over the tree.

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BehaviorTreeElement>

Get a mutable iterator over the tree.

Source

pub fn reset(&mut self) -> Result<(), BehaviorError>

Reset tree to initial state.

§Errors
  • if reset of children failed

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V