Trait libafl::corpus::Corpus

source ·
pub trait Corpus: UsesInput + Serialize + for<'de> Deserialize<'de> {
Show 14 methods fn count(&self) -> usize; fn add(&mut self, testcase: Testcase<Self::Input>) -> Result<CorpusId, Error>; fn replace(
        &mut self,
        idx: CorpusId,
        testcase: Testcase<Self::Input>
    ) -> Result<Testcase<Self::Input>, Error>; fn remove(&mut self, id: CorpusId) -> Result<Testcase<Self::Input>, Error>; fn get(&self, id: CorpusId) -> Result<&RefCell<Testcase<Self::Input>>, Error>; fn current(&self) -> &Option<CorpusId>; fn current_mut(&mut self) -> &mut Option<CorpusId>; fn next(&self, id: CorpusId) -> Option<CorpusId>; fn prev(&self, id: CorpusId) -> Option<CorpusId>; fn first(&self) -> Option<CorpusId>; fn last(&self) -> Option<CorpusId>; fn is_empty(&self) -> bool { ... } fn ids(&self) -> CorpusIdIterator<'_, Self> { ... } fn nth(&self, nth: usize) -> CorpusId { ... }
}
Expand description

Corpus with all current testcases

Required Methods§

source

fn count(&self) -> usize

Returns the number of elements

source

fn add(&mut self, testcase: Testcase<Self::Input>) -> Result<CorpusId, Error>

Add an entry to the corpus and return its index

source

fn replace(
    &mut self,
    idx: CorpusId,
    testcase: Testcase<Self::Input>
) -> Result<Testcase<Self::Input>, Error>

Replaces the testcase at the given idx, returning the existing.

source

fn remove(&mut self, id: CorpusId) -> Result<Testcase<Self::Input>, Error>

Removes an entry from the corpus, returning it if it was present.

source

fn get(&self, id: CorpusId) -> Result<&RefCell<Testcase<Self::Input>>, Error>

Get by id

source

fn current(&self) -> &Option<CorpusId>

Current testcase scheduled

source

fn current_mut(&mut self) -> &mut Option<CorpusId>

Current testcase scheduled (mutable)

source

fn next(&self, id: CorpusId) -> Option<CorpusId>

Get the next corpus id

source

fn prev(&self, id: CorpusId) -> Option<CorpusId>

Get the prev corpus id

source

fn first(&self) -> Option<CorpusId>

Get the first inserted corpus id

source

fn last(&self) -> Option<CorpusId>

Get the last inserted corpus id

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true, if no elements are in this corpus yet

source

fn ids(&self) -> CorpusIdIterator<'_, Self>

An iterator over very active corpus id

source

fn nth(&self, nth: usize) -> CorpusId

Get the nth corpus id

Implementors§

source§

impl<I> Corpus for CachedOnDiskCorpus<I>where
    I: Input,

source§

impl<I> Corpus for InMemoryCorpus<I>where
    I: Input,

source§

impl<I> Corpus for OnDiskCorpus<I>where
    I: Input,