Skip to main content

Parallel

Struct Parallel 

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

A Parallel behaviors executes its children concurrently in one thread.

It differs from ParallelAll in how it handles the parallelity: The standard variant is completed either when the success_threshold or the failure_threshold is reached. These are configured using the ports success_count and failure_count. If any of the thresholds is reached, still running children will be halted. Both ports default to -1 which means any number or don’t care.

The variant is gated behind the feature parallel.

Example:

<Parallel success_count="2" failure_count="1">
   <Behavior1/>
   <Behavior2/>
   <Behavior3/>
</Parallel>

Implementations§

Source§

impl Parallel

Source

pub fn register( registry: &mut impl BehaviorRegistry, name: &str, ) -> Result<(), Error>

Trait Implementations§

Source§

impl Behavior for Parallel

Source§

fn on_halt(&mut self) -> Result<(), Error>

Method called during stop/cancel/halt of a behavior, intended to reset the internal fields of your behavior. Read more
Source§

fn on_start( &mut self, behavior: &mut BehaviorData, children: &mut BehaviorTreeElementList, _runtime: &SharedRuntime, ) -> Result<(), Error>

Method is called before starting to tick a behavior, intended to do preliminary stuff for your behavior. Read more
Source§

fn tick<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, _behavior: &'life1 mut BehaviorData, children: &'life2 mut BehaviorTreeElementList, runtime: &'life3 SharedRuntime, ) -> Pin<Box<dyn Future<Output = BehaviorResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Method to tick a behavior. Read more
Source§

fn start<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, behavior: &'life1 mut BehaviorData, children: &'life2 mut BehaviorTreeElementList, runtime: &'life3 SharedRuntime, ) -> Pin<Box<dyn Future<Output = BehaviorResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Method is called on first tick of a behavior instead of tick(). If this method returns BehaviorState::Running, the behavior becomes asynchronous. Read more
Source§

fn halt( &mut self, _behavior: &mut BehaviorData, children: &mut BehaviorTreeElementList, runtime: &SharedRuntime, ) -> BehaviorResult

Method to halt a behavior. Read more
Source§

impl BehaviorExecution for Parallel

Source§

fn as_any(&self) -> &dyn Any

Dynamic downcasting.
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Mutable dynamic downcasting.
Source§

fn kind(&self) -> BehaviorKind

Get the BehaviorKind of the behavior.
Source§

fn portlist(&self) -> &dyn PortList

Access the PortList
Source§

fn portlist_mut(&mut self) -> &mut dyn PortList

Access the PortList
Source§

impl Debug for Parallel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PortCollectionProvider for Parallel

Source§

fn provided_ports(&self) -> &impl PortCollectionAccessors

Returns immutable access to the collections entries.
Source§

fn provided_ports_mut(&mut self) -> &mut impl PortCollectionAccessors

Returns mutable access to the collections entries.
Source§

fn port_collection(&self) -> &impl PortCollection

Returns an immutable PortCollection.

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> AnyPortValue for T
where T: Any + Send + Sync + Debug,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to Any
Source§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

Convert to mut Any
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.