pub trait MapObserver: HasLen + Named + Serialize + DeserializeOwned + Debug {
    type Entry: Bounded + PartialEq + Default + Copy + Debug + 'static;

    fn get(&self, idx: usize) -> &Self::Entry;
    fn get_mut(&mut self, idx: usize) -> &mut Self::Entry;
    fn usable_count(&self) -> usize;
    fn count_bytes(&self) -> u64;
    fn hash(&self) -> u64;
    fn initial(&self) -> Self::Entry;
    fn reset_map(&mut self) -> Result<(), Error>;
    fn to_vec(&self) -> Vec<Self::Entry> ;
    fn how_many_set(&self, indexes: &[usize]) -> usize;

    fn downsize_map(&mut self, _new_len: usize) -> Option<usize> { ... }
}
Expand description

A MapObserver observes the static map, as oftentimes used for AFL-like coverage information

TODO: enforce iter() -> AssociatedTypeIter when generic associated types stabilize

Required Associated Types§

source

type Entry: Bounded + PartialEq + Default + Copy + Debug + 'static

Type of each entry in this map

Required Methods§

source

fn get(&self, idx: usize) -> &Self::Entry

Get the value at idx

source

fn get_mut(&mut self, idx: usize) -> &mut Self::Entry

Get the value at idx (mutable)

source

fn usable_count(&self) -> usize

Get the number of usable entries in the map (all by default)

source

fn count_bytes(&self) -> u64

Count the set bytes in the map

source

fn hash(&self) -> u64

Compute the hash of the map

source

fn initial(&self) -> Self::Entry

Get the initial value for reset()

source

fn reset_map(&mut self) -> Result<(), Error>

Reset the map

source

fn to_vec(&self) -> Vec<Self::Entry>

Get these observer’s contents as Vec

source

fn how_many_set(&self, indexes: &[usize]) -> usize

Get the number of set entries with the specified indexes

Provided Methods§

source

fn downsize_map(&mut self, _new_len: usize) -> Option<usize>

Resize the inner map to be smaller (and thus faster to process) It returns Some(old size) on success, None on failure

Implementors§

source§

impl<'a, T> MapObserver for VariableMapObserver<'a, T>where
    T: Bounded + PartialEq + Default + Copy + 'static + Serialize + DeserializeOwned + Debug,

§

type Entry = T

source§

impl<'a, T, const DIFFERENTIAL: bool> MapObserver for MultiMapObserver<'a, T, DIFFERENTIAL>where
    T: Bounded + PartialEq + Default + Copy + 'static + Serialize + DeserializeOwned + Debug,

§

type Entry = T

source§

impl<'a, T, const DIFFERENTIAL: bool> MapObserver for StdMapObserver<'a, T, DIFFERENTIAL>where
    T: Bounded + PartialEq + Default + Copy + 'static + Serialize + DeserializeOwned + Debug,

§

type Entry = T

source§

impl<'a, T, const N: usize> MapObserver for ConstMapObserver<'a, T, N>where
    T: Bounded + PartialEq + Default + Copy + 'static + Serialize + DeserializeOwned + Debug,

§

type Entry = T

source§

impl<M> MapObserver for HitcountsIterableMapObserver<M>where
    for<'it> M: MapObserver<Entry = u8> + AsIterMut<'it, Item = u8>,

§

type Entry = u8

source§

impl<M> MapObserver for HitcountsMapObserver<M>where
    M: MapObserver<Entry = u8>,

§

type Entry = u8

source§

impl<T> MapObserver for OwnedMapObserver<T>where
    T: Bounded + PartialEq + Default + Copy + 'static + Serialize + DeserializeOwned + Debug,

§

type Entry = T