Skip to main content

UserContext

Trait UserContext 

Source
pub trait UserContext<E, M: Model<E>> {
    // Required methods
    fn current_tick(&self) -> SimTime;
    fn current_micro_step(&self) -> MicroStep;
    fn schedule_event(
        &mut self,
        delay: Duration,
        priority: EventPriority,
        event_payload: E,
    );
}
Expand description

Provides context information accessible by models during simulation execution.

Models use this context to query the current simulation time or to schedule future events.

Required Methods§

Source

fn current_tick(&self) -> SimTime

Returns the current simulation tick (absolute time).

Source

fn current_micro_step(&self) -> MicroStep

Returns the current micro-step (the index of the step within the current tick).

Source

fn schedule_event( &mut self, delay: Duration, priority: EventPriority, event_payload: E, )

Schedules an event with the specified delay and priority.

§Arguments
  • delay - The time elapsed from the current simulation time.
  • priority - The priority level of the event.
  • event_payload - The data payload associated with the scheduled event.

Implementors§

Source§

impl<E, M: Model<E>> UserContext<E, M> for EventContext<E, M>

Source§

impl<E, M: Model<E>> UserContext<E, M> for SourceContext<E, M>