Trait ErrorHandler

pub trait ErrorHandler: Sized {
    // Required methods
    fn spawn_multiple(n_threads: usize) -> impl IntoIterator<Item = Self>;
    fn handle_event(&mut self, value: Result<(), SimulationError>);
    fn do_continue(&mut self) -> Result<(), SimulationError>;

    // Provided method
    fn determine_strategy(&self, error: SimulationError) -> HandlingStrategy { ... }
}
Available on crate feature chili only.
Expand description

Handle any error which may occur as specified by SimulationError

Required Methods§

fn spawn_multiple(n_threads: usize) -> impl IntoIterator<Item = Self>

Creates multiple handlers which are responsible for individual threads.

fn handle_event(&mut self, value: Result<(), SimulationError>)

Accumulates an error event.

fn do_continue(&mut self) -> Result<(), SimulationError>

Determines if the simulation is able to be continued or not.

Provided Methods§

fn determine_strategy(&self, error: SimulationError) -> HandlingStrategy

Determines possible HandlingStrategy after having accumulated all possible errors.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§