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
);
}
Expand description
Interface of a simulation component.
Required Associated Types
Required Methods
fn process_event(
&self,
self_id: ComponentId<Self::Event>,
event: &Self::Event,
scheduler: &mut Scheduler,
state: &mut State
)
fn process_event(
&self,
self_id: ComponentId<Self::Event>,
event: &Self::Event,
scheduler: &mut Scheduler,
state: &mut State
)
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.