pub struct EventPhase<E, M: Model<E>> { /* private fields */ }Expand description
Manages the event execution phase in the simulation.
This structure holds the queue of events to be processed in the current micro-step, manages the execution of event handling by the model, handles event discarding, and performs phase-end procedures.
Implementations§
Source§impl<E, M: Model<E>> EventPhase<E, M>
impl<E, M: Model<E>> EventPhase<E, M>
Sourcepub fn get_context(&mut self) -> &mut EventContext<E, M>
pub fn get_context(&mut self) -> &mut EventContext<E, M>
Returns a mutable reference to the event context used in the current phase.
Sourcepub fn complete_event_phase(
self,
model: &M,
) -> MicroStepHandler<EventContext<E, M>>
pub fn complete_event_phase( self, model: &M, ) -> MicroStepHandler<EventContext<E, M>>
Completes the event phase and transitions to the next micro-step handler.
This invokes the after_event_phase hook to update the simulation state.
Sourcepub fn take_one_if<F>(&mut self, predicate: F) -> Option<Event<E>>
pub fn take_one_if<F>(&mut self, predicate: F) -> Option<Event<E>>
Searches for and pops the first event in the queue that satisfies the given predicate.
Sourcepub fn take_front_if<F>(&mut self, predicate: F) -> Option<Event<E>>
pub fn take_front_if<F>(&mut self, predicate: F) -> Option<Event<E>>
Pops an event from the front of the queue only if it satisfies the given predicate.
Sourcepub fn take_all_if<F>(&mut self, predicate: F) -> VecDeque<Event<E>>
pub fn take_all_if<F>(&mut self, predicate: F) -> VecDeque<Event<E>>
Extracts and returns all events from the queue that satisfy the given predicate.
Events that do not satisfy the predicate remain in the queue.
Sourcepub fn handle_event(&mut self, model: &mut M, event: Event<E>)
pub fn handle_event(&mut self, model: &mut M, event: Event<E>)
Processes the specified event using the model.
This invokes the before_event and after_event hooks surrounding the event processing.
Auto Trait Implementations§
impl<E, M> Freeze for EventPhase<E, M>
impl<E, M> !RefUnwindSafe for EventPhase<E, M>
impl<E, M> !Send for EventPhase<E, M>
impl<E, M> !Sync for EventPhase<E, M>
impl<E, M> Unpin for EventPhase<E, M>where
E: Unpin,
impl<E, M> UnsafeUnpin for EventPhase<E, M>
impl<E, M> !UnwindSafe for EventPhase<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
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>
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>
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