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§
sourcefn add(&mut self, testcase: Testcase<Self::Input>) -> Result<CorpusId, Error>
fn add(&mut self, testcase: Testcase<Self::Input>) -> Result<CorpusId, Error>
Add an entry to the corpus and return its index
sourcefn replace(
&mut self,
idx: CorpusId,
testcase: Testcase<Self::Input>
) -> Result<Testcase<Self::Input>, Error>
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.
sourcefn remove(&mut self, id: CorpusId) -> Result<Testcase<Self::Input>, Error>
fn remove(&mut self, id: CorpusId) -> Result<Testcase<Self::Input>, Error>
Removes an entry from the corpus, returning it if it was present.
sourcefn current_mut(&mut self) -> &mut Option<CorpusId>
fn current_mut(&mut self) -> &mut Option<CorpusId>
Current testcase scheduled (mutable)
Provided Methods§
sourcefn ids(&self) -> CorpusIdIterator<'_, Self> ⓘ
fn ids(&self) -> CorpusIdIterator<'_, Self> ⓘ
An iterator over very active corpus id