Skip to main content

Callback

Trait Callback 

Source
pub trait Callback: Send {
    // Provided methods
    fn on_run_start(&mut self, _info: &RunInfo) { ... }
    fn on_condition_start(
        &mut self,
        _index: usize,
        _condition: &Condition,
    ) -> Action { ... }
    fn on_batch_end(&mut self, _progress: &Progress<'_>) -> Action { ... }
    fn on_condition_end(&mut self, _result: &ConditionResult) -> Action { ... }
    fn on_run_end(&mut self, _results: &[ConditionResult]) { ... }
}
Expand description

Hooks into a run (all optional).

Provided Methods§

Source

fn on_run_start(&mut self, _info: &RunInfo)

Before the first condition.

Source

fn on_condition_start( &mut self, _index: usize, _condition: &Condition, ) -> Action

Before a condition: Action::Skip does not run it.

Source

fn on_batch_end(&mut self, _progress: &Progress<'_>) -> Action

After every batch of trials: Action::StopCondition stops the condition.

Source

fn on_condition_end(&mut self, _result: &ConditionResult) -> Action

After a condition (run or skipped): Action::StopRun ends the run.

Source

fn on_run_end(&mut self, _results: &[ConditionResult])

After the last condition.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§