pub trait Corpus: UsesInput + Serialize + for<'de> Deserialize<'de> {
Show 22 methods
// Required methods
fn count(&self) -> usize;
fn count_disabled(&self) -> usize;
fn count_all(&self) -> usize;
fn add(
&mut self,
testcase: Testcase<Self::Input>
) -> Result<CorpusId, Error>;
fn add_disabled(
&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 get_from_all(
&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 nth_from_all(&self, nth: usize) -> 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 count_disabled(&self) -> usize
fn count_disabled(&self) -> usize
Returns the number of all disabled entries
sourcefn add(&mut self, testcase: Testcase<Self::Input>) -> Result<CorpusId, Error>
fn add(&mut self, testcase: Testcase<Self::Input>) -> Result<CorpusId, Error>
Add an enabled testcase to the corpus and return its index
sourcefn add_disabled(
&mut self,
testcase: Testcase<Self::Input>
) -> Result<CorpusId, Error>
fn add_disabled( &mut self, testcase: Testcase<Self::Input> ) -> Result<CorpusId, Error>
Add a disabled testcase 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 get(&self, id: CorpusId) -> Result<&RefCell<Testcase<Self::Input>>, Error>
fn get(&self, id: CorpusId) -> Result<&RefCell<Testcase<Self::Input>>, Error>
Get by id; considers only enabled testcases
sourcefn get_from_all(
&self,
id: CorpusId
) -> Result<&RefCell<Testcase<Self::Input>>, Error>
fn get_from_all( &self, id: CorpusId ) -> Result<&RefCell<Testcase<Self::Input>>, Error>
Get by id; considers both enabled and disabled testcases
sourcefn current_mut(&mut self) -> &mut Option<CorpusId>
fn current_mut(&mut self) -> &mut Option<CorpusId>
Current testcase scheduled (mutable)
sourcefn nth_from_all(&self, nth: usize) -> CorpusId
fn nth_from_all(&self, nth: usize) -> CorpusId
Get the nth corpus id; considers both enabled and disabled testcases
Provided Methods§
sourcefn ids(&self) -> CorpusIdIterator<'_, Self> ⓘ
fn ids(&self) -> CorpusIdIterator<'_, Self> ⓘ
An iterator over very active corpus id
Object Safety§
This trait is not object safe.