Trait simrs::Component[][src]

pub trait Component: ProcessEventEntry {
    type Event: Debug + 'static;
    fn process_event(
        &self,
        self_id: ComponentId<Self::Event>,
        event: &Self::Event,
        scheduler: &mut Scheduler,
        state: &mut State
    ); }

Interface of a simulation component.

Associated Types

type Event: Debug + 'static[src]

Type of event the component reacts to.

Loading content...

Required methods

fn process_event(
    &self,
    self_id: ComponentId<Self::Event>,
    event: &Self::Event,
    scheduler: &mut Scheduler,
    state: &mut State
)
[src]

Reacts to event. A component has access to the following elements of the simulation:

  • self_id: This is the ID of this component. This is used to schedule events to itself. This is passed for convenience, as the ID is only known after the component has been already constructed and passed to the simulation.
  • event: The occurring event.
  • scheduler: The scheduler used to access time and schedule new events.
  • state: The state is used to access queues and values in the value store.
Loading content...

Implementors

Loading content...