pub struct AgentContinuation<E, M: Model<E>> { /* private fields */ }Implementations§
Source§impl<E: 'static, M: Model<E> + 'static> AgentContinuation<E, M>
impl<E: 'static, M: Model<E> + 'static> AgentContinuation<E, M>
Sourcepub fn new<F>(to_event_payload: F) -> Selfwhere
F: Fn(AgentContinuation<E, M>) -> E + 'static,
pub fn new<F>(to_event_payload: F) -> Selfwhere
F: Fn(AgentContinuation<E, M>) -> E + 'static,
Creates a new AgentContinuation instance.
§Arguments
to_event_payload- A closure that defines how to transform the continuation into an event payload for scheduling the next step.
Sourcepub fn then_after<F>(
self,
tag: &'static str,
delay: Duration,
priority: EventPriority,
logic: F,
) -> Self
pub fn then_after<F>( self, tag: &'static str, delay: Duration, priority: EventPriority, logic: F, ) -> Self
Appends a new step to be executed after the specified delay.
§Arguments
tag- A descriptive label for the step, useful for debugging and tracking.delay- The time duration to wait before executing this step.priority- The priority of the event within the event scheduler.logic- The closure containing the logic to be executed for this step.
Source§impl<E, M: Model<E>> AgentContinuation<E, M>
impl<E, M: Model<E>> AgentContinuation<E, M>
Sourcepub fn peek_next_step(&self) -> Option<&AgentStep<E, M>>
pub fn peek_next_step(&self) -> Option<&AgentStep<E, M>>
Returns a reference to the next step scheduled to be executed, without consuming it.
Sourcepub fn peek_next_step_tag(&self) -> Option<&'static str>
pub fn peek_next_step_tag(&self) -> Option<&'static str>
Returns the tag of the next scheduled step, if available.
Sourcepub fn get_remain_step_count(&self) -> usize
pub fn get_remain_step_count(&self) -> usize
Returns the total number of steps remaining in the continuation.
Sourcepub fn execute_and_schedule(
self,
context: &mut EventContext<E, M>,
model: &mut M,
)
pub fn execute_and_schedule( self, context: &mut EventContext<E, M>, model: &mut M, )
Consumes and executes the current step, then schedules the next step if one exists. If no further steps remain, the continuation concludes gracefully.
Trait Implementations§
Auto Trait Implementations§
impl<E, M> Freeze for AgentContinuation<E, M>
impl<E, M> !RefUnwindSafe for AgentContinuation<E, M>
impl<E, M> !Send for AgentContinuation<E, M>
impl<E, M> !Sync for AgentContinuation<E, M>
impl<E, M> Unpin for AgentContinuation<E, M>
impl<E, M> UnsafeUnpin for AgentContinuation<E, M>
impl<E, M> !UnwindSafe for AgentContinuation<E, M>
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> 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