pub trait Corpus: UsesInput + Serialize + for<'de> Deserialize<'de> {
Show 17 methods
// Required 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 load_input_into(
&self,
testcase: &mut Testcase<Self::Input>
) -> Result<(), Error>;
fn store_input_from(
&self,
testcase: &Testcase<Self::Input>
) -> Result<(), Error>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn ids(&self) -> CorpusIdIterator<'_, Self> ⓘ { ... }
fn nth(&self, nth: usize) -> CorpusId { ... }
fn cloned_input_for_id(&self, idx: CorpusId) -> Result<Self::Input, Error> { ... }
}
Expand description
Corpus with all current Testcase
s, or solutions
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