Trait SensorAndPool

Source
pub trait SensorAndPool: SaveToStatsFolder {
    // Required methods
    fn stats(&self) -> Box<dyn Stats>;
    fn start_recording(&mut self);
    fn stop_recording(&mut self);
    fn process(
        &mut self,
        input_id: PoolStorageIndex,
        cplx: f64,
    ) -> Vec<CorpusDelta>;
    fn get_random_index(&mut self) -> Option<PoolStorageIndex>;
}
Expand description

An object safe trait that combines the methods of the Sensor, Pool, and CompatibleWithObservations traits.

While it’s often useful to work with the Sensor and Pool traits separately, the fuzzer doesn’t actually need to know about the sensor and pool individually. By having this SensorAndPool trait, we can give the fuzzer a Box<dyn SensorAndPool> and get rid of two generic type parameters: S: Sensor and P: Pool + CompatibleWithObservations<S::Observations>.

This is better for compile times and simplifies the implementation of the fuzzer. Users of fuzzcheck should feel free to ignore this trait, as it is arguably more an implementation detail than a fundamental building block of the fuzzer.

Currently, there are two types implementing SensorAndPool:

  1. (S, P) where S: Sensor and P: Pool + CompatibleWithObservations<S::Observations>
  2. AndSensorAndPool

Required Methods§

Source

fn stats(&self) -> Box<dyn Stats>

Source

fn start_recording(&mut self)

Source

fn stop_recording(&mut self)

Source

fn process(&mut self, input_id: PoolStorageIndex, cplx: f64) -> Vec<CorpusDelta>

Source

fn get_random_index(&mut self) -> Option<PoolStorageIndex>

Implementations on Foreign Types§

Source§

impl<S, P> SensorAndPool for (S, P)

Source§

fn stats(&self) -> Box<dyn Stats>

Source§

fn start_recording(&mut self)

Source§

fn stop_recording(&mut self)

Source§

fn process( &mut self, input_id: PoolStorageIndex, complexity: f64, ) -> Vec<CorpusDelta>

Source§

fn get_random_index(&mut self) -> Option<PoolStorageIndex>

Implementors§