pub struct BehaviorExecutor { /* private fields */ }Implementations§
Source§impl BehaviorExecutor
impl BehaviorExecutor
Sourcepub fn new(
behavior: Box<dyn BehaviorNode>,
tick_rate_hz: f32,
) -> BehaviorExecutor
pub fn new( behavior: Box<dyn BehaviorNode>, tick_rate_hz: f32, ) -> BehaviorExecutor
Create a new behavior executor.
§Arguments
behavior- The behavior to executetick_rate_hz- Tick rate in Hz (e.g., 30.0 for 30 Hz)
pub fn with_max_ticks(self, max_ticks: usize) -> BehaviorExecutor
pub async fn init(&mut self, ctx: &Context) -> Result<(), Error>
Sourcepub async fn run_until_complete(
&mut self,
ctx: &Context,
) -> Result<(NodeStatus, ExecutionStats), Error>
pub async fn run_until_complete( &mut self, ctx: &Context, ) -> Result<(NodeStatus, ExecutionStats), Error>
Run the behavior until it completes (Success or Failure).
This will tick the behavior at the configured rate until it returns a terminal status (Success or Failure).
§Returns
The final status and execution statistics.
Sourcepub async fn run_for_duration(
&mut self,
ctx: &Context,
duration: Duration,
) -> Result<(NodeStatus, ExecutionStats), Error>
pub async fn run_for_duration( &mut self, ctx: &Context, duration: Duration, ) -> Result<(NodeStatus, ExecutionStats), Error>
Run the behavior for a fixed duration.
This will tick the behavior at the configured rate for the specified duration, regardless of whether it completes.
pub async fn terminate(&mut self, ctx: &Context) -> Result<(), Error>
Auto Trait Implementations§
impl !RefUnwindSafe for BehaviorExecutor
impl !UnwindSafe for BehaviorExecutor
impl Freeze for BehaviorExecutor
impl Send for BehaviorExecutor
impl Sync for BehaviorExecutor
impl Unpin for BehaviorExecutor
impl UnsafeUnpin for BehaviorExecutor
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more