Trait libafl::observers::map::MapObserver
source · 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§
Required Methods§
sourcefn usable_count(&self) -> usize
fn usable_count(&self) -> usize
Get the number of usable entries in the map (all by default)
sourcefn count_bytes(&self) -> u64
fn count_bytes(&self) -> u64
Count the set bytes in the map
sourcefn how_many_set(&self, indexes: &[usize]) -> usize
fn how_many_set(&self, indexes: &[usize]) -> usize
Get the number of set entries with the specified indexes
Provided Methods§
sourcefn downsize_map(&mut self, _new_len: usize) -> Option<usize>
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