pub struct CaseSet {
pub version: Option<u32>,
pub cases: Vec<Case>,
}Expand description
Fields§
§version: Option<u32>Format version of this file, for callers that need to evolve the schema. Not otherwise interpreted by this SDK.
cases: Vec<Case>The cases, in file order.
Implementations§
Source§impl CaseSet
impl CaseSet
Sourcepub fn from_json_str(json: &str) -> Result<Self, Error>
pub fn from_json_str(json: &str) -> Result<Self, Error>
Parses a CaseSet from a JSON document.
§Errors
Error::Parse if json is not valid JSON; Error::Invalid if it parses
but fails case-set validation (see the module-level docs).
Sourcepub fn from_json_value(value: Value) -> Result<Self, Error>
pub fn from_json_value(value: Value) -> Result<Self, Error>
Parses a CaseSet from an already-parsed JSON value.
§Errors
Error::Parse if value does not match the case-set schema; Error::Invalid
if it parses but fails case-set validation.
Sourcepub fn from_yaml_str(yaml: &str) -> Result<Self, Error>
pub fn from_yaml_str(yaml: &str) -> Result<Self, Error>
Parses a CaseSet from a YAML document.
§Errors
Error::Parse if yaml is not valid YAML; Error::Invalid if it parses
but fails case-set validation.
Sourcepub async fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
pub async fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
Loads a CaseSet from a file, choosing the JSON or YAML parser by extension
(.json vs. .yaml/.yml).
Reads the file with tokio::fs, not std::fs, so it never blocks the async
runtime’s worker thread.
§Errors
Error::Io if the file cannot be read; Error::Invalid if the extension is
missing, unrecognized, or names a YAML file while the yaml feature is
disabled, or if the parsed content fails case-set validation; Error::Parse
if the content is not well-formed JSON/YAML.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether there are no cases.
Never true for a successfully loaded CaseSet: loading rejects an empty
cases list. Provided for API symmetry with
Vec::is_empty and to satisfy clippy::len_without_is_empty.
Sourcepub fn as_slice(&self) -> &[Case]
pub fn as_slice(&self) -> &[Case]
Borrows the cases as a slice, for crate::run_cases.