Trait libafl::corpus::Corpus[][src]

pub trait Corpus<I>: Serialize + DeserializeOwned where
    I: Input
{ fn count(&self) -> usize;
fn add(&mut self, testcase: Testcase<I>) -> Result<usize, Error>;
fn replace(
        &mut self,
        idx: usize,
        testcase: Testcase<I>
    ) -> Result<(), Error>;
fn remove(&mut self, idx: usize) -> Result<Option<Testcase<I>>, Error>;
fn get(&self, idx: usize) -> Result<&RefCell<Testcase<I>>, Error>;
fn current(&self) -> &Option<usize>;
fn current_mut(&mut self) -> &mut Option<usize>; fn is_empty(&self) -> bool { ... } }

Corpus with all current testcases

Required methods

fn count(&self) -> usize[src]

Returns the number of elements

fn add(&mut self, testcase: Testcase<I>) -> Result<usize, Error>[src]

Add an entry to the corpus and return its index

fn replace(&mut self, idx: usize, testcase: Testcase<I>) -> Result<(), Error>[src]

Replaces the testcase at the given idx

fn remove(&mut self, idx: usize) -> Result<Option<Testcase<I>>, Error>[src]

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

fn get(&self, idx: usize) -> Result<&RefCell<Testcase<I>>, Error>[src]

Get by id

fn current(&self) -> &Option<usize>[src]

Current testcase scheduled

fn current_mut(&mut self) -> &mut Option<usize>[src]

Current testcase scheduled (mut)

Loading content...

Provided methods

fn is_empty(&self) -> bool[src]

Returns true, if no elements are in this corpus yet

Loading content...

Implementors

impl<I> Corpus<I> for InMemoryCorpus<I> where
    I: Input
[src]

fn count(&self) -> usize[src]

Returns the number of elements

fn add(&mut self, testcase: Testcase<I>) -> Result<usize, Error>[src]

Add an entry to the corpus and return its index

fn replace(&mut self, idx: usize, testcase: Testcase<I>) -> Result<(), Error>[src]

Replaces the testcase at the given idx

fn remove(&mut self, idx: usize) -> Result<Option<Testcase<I>>, Error>[src]

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

fn get(&self, idx: usize) -> Result<&RefCell<Testcase<I>>, Error>[src]

Get by id

fn current(&self) -> &Option<usize>[src]

Current testcase scheduled

fn current_mut(&mut self) -> &mut Option<usize>[src]

Current testcase scheduled (mut)

impl<I> Corpus<I> for OnDiskCorpus<I> where
    I: Input
[src]

fn count(&self) -> usize[src]

Returns the number of elements

fn add(&mut self, testcase: Testcase<I>) -> Result<usize, Error>[src]

Add an entry to the corpus and return its index

fn replace(&mut self, idx: usize, testcase: Testcase<I>) -> Result<(), Error>[src]

Replaces the testcase at the given idx

fn remove(&mut self, idx: usize) -> Result<Option<Testcase<I>>, Error>[src]

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

fn get(&self, idx: usize) -> Result<&RefCell<Testcase<I>>, Error>[src]

Get by id

fn current(&self) -> &Option<usize>[src]

Current testcase scheduled

fn current_mut(&mut self) -> &mut Option<usize>[src]

Current testcase scheduled (mut)

Loading content...