Skip to main content

Model

Trait Model 

Source
pub trait Model<E>: Sized {
    // Required method
    fn handle_event(
        &mut self,
        context: &mut EventContext<E, Self>,
        event: &Event<E>,
    );
}
Expand description

Defines the interface for a simulation model that processes events.

Models implementing this trait are responsible for reacting to events triggered within the simulation and updating their internal state accordingly.

Required Methods§

Source

fn handle_event( &mut self, context: &mut EventContext<E, Self>, event: &Event<E>, )

Handles an incoming event within the provided simulation context.

§Arguments
  • context - The simulation context, providing access to state, scheduling, and hooks.
  • event - The event to be processed by this model.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§