pub struct BehaviorTree { /* private fields */ }Expand description
A Tree of BehaviorTreeElements.
A certain BehaviorTree can contain up to 65536 BehaviorTreeElements.
Implementations§
Source§impl BehaviorTree
impl BehaviorTree
Sourcepub fn new(root: BehaviorTreeElement, registry: &BehaviorRegistry) -> Self
pub fn new(root: BehaviorTreeElement, registry: &BehaviorRegistry) -> Self
create a Tree with reference to its libraries
Sourcepub const fn blackboard(&self) -> &Databoard
pub const fn blackboard(&self) -> &Databoard
Access the root blackboard of the tree.
Sourcepub fn subtree(&self, index: usize) -> Result<&BehaviorTreeElement, Error>
pub fn subtree(&self, index: usize) -> Result<&BehaviorTreeElement, Error>
Sourcepub fn sender(&self) -> Sender<BehaviorTreeMessage>
pub fn sender(&self) -> Sender<BehaviorTreeMessage>
Get a message sender. This sender can be used to modify the tree while running.
Sourcepub async fn tick_exactly_once(&mut self) -> BehaviorResult
pub async fn tick_exactly_once(&mut self) -> BehaviorResult
Ticks the tree exactly once.
§Errors
Sourcepub async fn tick_once(&mut self) -> BehaviorResult
pub async fn tick_once(&mut self) -> BehaviorResult
Ticks the tree once. @TODO: The wakeup mechanism is not yet implemented
§Errors
Sourcepub async fn tick_while_running(&mut self) -> BehaviorResult
pub async fn tick_while_running(&mut self) -> BehaviorResult
Ticks the tree until it finishes either with BehaviorState::Success or BehaviorState::Failure.
§Errors
Sourcepub fn iter(&self) -> impl Iterator<Item = &BehaviorTreeElement>
pub fn iter(&self) -> impl Iterator<Item = &BehaviorTreeElement>
Get an iterator over the tree.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BehaviorTreeElement>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BehaviorTreeElement>
Get a mutable iterator over the tree.
Auto Trait Implementations§
impl Freeze for BehaviorTree
impl !RefUnwindSafe for BehaviorTree
impl Send for BehaviorTree
impl Sync for BehaviorTree
impl Unpin for BehaviorTree
impl !UnwindSafe for BehaviorTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more