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
:
(S, P)
whereS: Sensor
andP: Pool + CompatibleWithObservations<S::Observations>
AndSensorAndPool