pub trait MetricsHandler: Send {
    // Required methods
    fn handle(&mut self, event: &dyn SimulationEvent);
    fn get_value(&self) -> f64;
    fn as_any(&self) -> &dyn Any;
}
Expand description

The MetricsHandler trait defines the interface for handling simulation events and extracting metric values.

Implementors of this trait should process the events and update their internal state to compute the desired metric.

Required Methods§

source

fn handle(&mut self, event: &dyn SimulationEvent)

Handles a simulation event.

Arguments
  • event - A reference to a simulation event.
source

fn get_value(&self) -> f64

Returns the current value of the metric.

Returns

A f64 representing the current value of the metric.

source

fn as_any(&self) -> &dyn Any

Returns a reference to the underlying Any type for downcasting.

Returns

A reference to the underlying Any type.

Implementors§