Skip to main content

Corpus

Struct Corpus 

Source
#[non_exhaustive]
pub struct Corpus { pub header: Header, pub cases: Vec<Case>, }
Expand description

A whole corpus (record.md §1).

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§header: Header

The header line (record.md §2).

§cases: Vec<Case>

The cases, in file order, which is byte order of their names.

Implementations§

Source§

impl Corpus

Source

pub fn case(&self, name: &str) -> Option<&Case>

The case with this name.

Source

pub fn surface(&self) -> Option<BTreeSet<&str>>

The keys of the BASELINE_CASE key lines: every key ADP modeled when the corpus was recorded.

The set is fixed at recording time. It changes only when the corpus is re-recorded, never when ADP’s support for a key changes afterwards. Keys are lowercase, as the reader requires.

Returns None when the baseline case did not start, so a missing baseline cannot pass as an empty set. crate::read rejects a corpus without a baseline case, but not one whose baseline hit a startup error.

Source

pub fn first_snapshot(&self, case: &str) -> Option<BTreeMap<&str, &Setting>>

Rebuilds a case’s first snapshot, key to setting, by the three layers of record.md §3.2: the baseline-default case’s key-line snapshots, then the case’s side_effects (an absent element removes the key), then the case’s own key-line snapshots (null removes the key).

Keys the corpus neither models nor saw change are not in the result. Returns None when the case does not exist or did not start. Without a started baseline case, layer 1 is empty.

Trait Implementations§

Source§

impl Clone for Corpus

Source§

fn clone(&self) -> Corpus

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Corpus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.