Skip to main content

Scenario

Trait Scenario 

Source
pub trait Scenario: Sync {
    type State: Sync;

    // Required methods
    fn name(&self) -> &str;
    fn setup(&self, condition: &Condition) -> Result<Self::State>;
    fn trial(
        &self,
        state: &Self::State,
        condition: &Condition,
        rng: &mut Rng,
        record: &mut Record,
    ) -> Result<()>;
}
Expand description

One random trial of a link, evaluated under many conditions.

Required Associated Types§

Source

type State: Sync

The per-condition state built by Scenario::setup and shared by the trials.

Required Methods§

Source

fn name(&self) -> &str

The name of the scenario (it enters the seeds of the trials and the reports).

Source

fn setup(&self, condition: &Condition) -> Result<Self::State>

Build the state of a condition (run once per condition, before its trials).

§Errors

Any error of the blocks built for the condition; the run stops with it.

Source

fn trial( &self, state: &Self::State, condition: &Condition, rng: &mut Rng, record: &mut Record, ) -> Result<()>

Run one trial: draw from rng only, record the metrics in record.

§Errors

Any error of the blocks of the trial; the run stops with it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F> Scenario for FnScenario<F>
where F: Fn(&Condition, &mut Rng, &mut Record) -> Result<()> + Sync,