pub trait Event: Named + Debug + ToString {
type State;
fn apply(
&self,
state: &mut Self::State,
queue: &mut Queue<'_, Self::State>
) -> Result<(), TransitionError>;
}
Expand description
Specification of a discrete event.
Required Associated Types§
Required Methods§
sourcefn apply(
&self,
state: &mut Self::State,
queue: &mut Queue<'_, Self::State>
) -> Result<(), TransitionError>
fn apply(
&self,
state: &mut Self::State,
queue: &mut Queue<'_, Self::State>
) -> Result<(), TransitionError>
Evaluates the event in the course of a simulation, applying it to the current state to
produce the next state (by mutating the state
reference in-place). The event may
also insert or append new events to the pending queue. (Changes to the queue, if any, will
only be persisted after Event::apply()
returns.)
Errors
TransitionError
if the event could not be evaluated.