WhenAll

Struct WhenAll 

Source
pub struct WhenAll<C>(/* private fields */);
Expand description

A node that runs its child nodes in turn until all of them complete. If all the children return Status::Success, then this node also returns Status::Success, otherwise it returns Status::Failure after the first child node that fails. If there are no failures but there is at least one node that returns Status::Running, all the nodes are run and Status::Running is returned. This node is similar to [Seq], with the difference being that this node runs its children even after one of them returns Status::Running, instead of waiting for the next call of Bhv::update.

Implementations§

Source§

impl<C> WhenAll<C>

Source

pub fn new(bhvs: Box<[Box<dyn Bhv<Context = C>>]>) -> Self

Trait Implementations§

Source§

impl<C> Bhv for WhenAll<C>

Source§

type Context = C

The context passed to the node every frame.
Source§

fn update(&mut self, ctx: &mut Self::Context) -> Status

Update the state of the behavior tree based on some global context.
Source§

fn reset(&mut self, _status: Status)

Reset the node to initial status after completion, if needed. Defaults to nothing.
Source§

fn execute(self, ctx: &mut Self::Context) -> bool
where Self: Sized,

Update the node until it returns a value different from Status::Running. Read more

Auto Trait Implementations§

§

impl<C> Freeze for WhenAll<C>

§

impl<C> !RefUnwindSafe for WhenAll<C>

§

impl<C> !Send for WhenAll<C>

§

impl<C> !Sync for WhenAll<C>

§

impl<C> Unpin for WhenAll<C>

§

impl<C> !UnwindSafe for WhenAll<C>

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<B> BhvExt for B
where B: Bhv,

Source§

fn inv(self) -> Inv<Self>

Return a node that inverts the result of this node. Read more
Source§

fn pass(self) -> Pass<Self>

Return a node that runs this node and returns Status::Success when done. Read more
Source§

fn fail(self) -> Fail<Self>

Return a node that runs this node and returns Status::Failure when done. Read more
Source§

fn run_if<C>(self, cond: C) -> RunIf<Self, C>
where C: Fn(&Self::Context) -> bool,

Return a node that runs this node as long as the specified condition holds true. Read more
Source§

fn repeat(self, count: u32) -> Repeat<Self>

Return a node that runs this node the given number of times and returns the last exit status when done. Read more
Source§

fn repeat_until<C>(self, cond: C) -> RepeatUntil<Self, C>
where C: Fn(&Self::Context) -> bool,

Return a node that runs this node then checks the passed condition until the condition returns true. The node then returns the last exit status when done. Read more
Source§

fn repeat_until_pass(self) -> RepeatUntilPass<Self>

Return a node that runs this node until it returns Status::Success. Read more
Source§

fn repeat_until_fail(self) -> RepeatUntilFail<Self>

Return a node that runs this node until it returns Status::Failure. 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.