pub enum Question {
Choice {
instructions: String,
criteria: BTreeMap<String, String>,
},
Score {
instructions: String,
criteria: Vec<String>,
},
Noul {
instructions: String,
criteria: Option<NoulCriteria>,
},
}Expand description
A single question asked of the state.
Internally tagged on type (choice | score | noul) — each variant’s
shape, in particular whether criteria is a map, an ordered list, or
optional, differs by primitive and is not expressible as one flat struct.
Variants§
Choice
Pick exactly one of a labelled set of options.
Fields
Score
Rate the state against an ordered scale.
Fields
Noul
Estimate the probability of a yes/no condition.
Fields
criteria: Option<NoulCriteria>Optional descriptions of what “true” and “false” mean. Omitted
entirely from the request when None.
Implementations§
Source§impl Question
impl Question
Sourcepub fn validate(&self) -> Result<(), JevError>
pub fn validate(&self) -> Result<(), JevError>
Rejects degenerate questions: a choice needs at least
MIN_CHOICE_OPTIONS options and a score at least
MIN_SCORE_LEVELS levels. noul has none.
This is omni-dev policy, not an API constraint: the live API accepts a
one-option choice and a one-level score with 200, but can only
ever answer them with confidence: 1.0, so the paid call carries no
information and almost always means a mistyped spec.
Duplicate choice option names cannot be detected here — a
BTreeMap has already collapsed them — so the --option parser
checks those itself.
Sourcepub fn validate_for_model(&self, model: &str) -> Result<(), JevError>
pub fn validate_for_model(&self, model: &str) -> Result<(), JevError>
Self::validate, plus the upper size limits model is known to
enforce (see QuestionLimits::for_model). The minimums apply to every
model; the caps only to a model whose limits are known, so the error
names the model they came from.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Question
impl<'de> Deserialize<'de> for Question
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Question
impl StructuralPartialEq for Question
Auto Trait Implementations§
impl Freeze for Question
impl RefUnwindSafe for Question
impl Send for Question
impl Sync for Question
impl Unpin for Question
impl UnsafeUnpin for Question
impl UnwindSafe for Question
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more