pub struct Case {
pub id: String,
pub name: Option<String>,
pub state: State,
pub questions: IndexMap<String, CaseQuestion>,
}Expand description
One predefined case: one state, one or more questions, one API call.
Construct these by deserializing a CaseSet, which validates questions eagerly
via Case::build_questions; there is no public unchecked constructor.
Fields§
§id: StringCaller-defined identifier for this case, echoed back on CaseResult for log
correlation and report keying.
name: Option<String>Optional human-readable label, distinct from id (dashboards, reports).
state: StateThe state this case’s questions are evaluated against.
questions: IndexMap<String, CaseQuestion>Question key -> question, in file order.
Implementations§
Source§impl Case
impl Case
Sourcepub fn build_questions(&self) -> Result<Questions, Error>
pub fn build_questions(&self) -> Result<Questions, Error>
Converts this case’s questions into a validated Questions, running the
same checks QuestionsBuilder::build applies to the hand-written path.
This does not itself validate id/name; CaseSet::from_json_str and
friends do so for every case as part of loading the whole file.
§Errors
Error::Invalid on the first invariant violated: question count,
duplicate/invalid keys, guidance length, or option/level counts.