pub struct Suite {
pub name: String,
pub items: Vec<EvalItem>,
}Expand description
A set of items with a name.
Fields§
§name: StringWhat the suite is called, in reports and baselines.
items: Vec<EvalItem>The items, in the order they run.
Implementations§
Source§impl Suite
impl Suite
Sourcepub fn new(
name: impl Into<String>,
items: Vec<EvalItem>,
) -> Result<Self, CorpusError>
pub fn new( name: impl Into<String>, items: Vec<EvalItem>, ) -> Result<Self, CorpusError>
Builds a suite, validating every item and refusing duplicate identifiers.
§Errors
CorpusError::Invalidfrom any item’s own validation;CorpusError::DuplicateIdwhen two items share an identifier, which would make a report join two different measurements.
Sourcepub fn with_provenance(
name: impl Into<String>,
items: Vec<EvalItem>,
provenance: Provenance,
) -> Result<Self, CorpusError>
pub fn with_provenance( name: impl Into<String>, items: Vec<EvalItem>, provenance: Provenance, ) -> Result<Self, CorpusError>
Suite::new, with a blanket Provenance folded into every item that
has the part.
Each item is validated with the declaration it wrote before the blanket is folded in, so a typo in a file is still an error naming that file’s field, and the blanket is never one. An item that declared a part itself keeps its own answer; the blanket only fills in the parts the item left authored.
§Errors
Whatever Suite::new raises.
Sourcepub fn load_item(path: impl AsRef<Path>) -> Result<EvalItem, CorpusError>
pub fn load_item(path: impl AsRef<Path>) -> Result<EvalItem, CorpusError>
Loads one item from a .toml or .json file.
§Errors
CorpusError::Readwhen the file cannot be read;CorpusError::UnknownFormatwhen the extension is neither;CorpusError::Parsewhen the document is malformed or carries a key this crate does not understand;CorpusError::Invalidwhen the item parses but cannot mean anything.
Sourcepub fn load_manifest(
dir: impl AsRef<Path>,
) -> Result<SuiteManifest, CorpusError>
pub fn load_manifest( dir: impl AsRef<Path>, ) -> Result<SuiteManifest, CorpusError>
Loads the SuiteManifest of a directory, if it has one.
The manifest is suite.toml or suite.json beside the items. A
directory without one has no blanket declaration, which is the ordinary
case.
§Errors
CorpusError::Readwhen the file exists and cannot be read;CorpusError::Parsewhen it is not a manifest, including when it names a part this crate does not know.
Sourcepub fn load_dir(
name: impl Into<String>,
dir: impl AsRef<Path>,
) -> Result<Self, CorpusError>
pub fn load_dir( name: impl Into<String>, dir: impl AsRef<Path>, ) -> Result<Self, CorpusError>
Loads every .toml and .json item in a directory, in file-name order,
with the directory’s SuiteManifest applied.
A suite.toml or suite.json in the directory is the manifest, not an
item.
§Errors
CorpusError::Readwhen the directory or one of its files cannot be read;- whatever
Suite::load_manifest,Suite::load_itemandSuite::with_provenanceraise.
Sourcepub fn select(&self, selection: &SelectionConfig) -> Vec<&EvalItem>
pub fn select(&self, selection: &SelectionConfig) -> Vec<&EvalItem>
The items a selection runs, in suite order.
Every tag used in the suite, sorted and deduplicated.