pub enum Question {
Noul {
instructions: Value,
criteria: Option<NoulCriteria>,
},
Choice {
instructions: Value,
criteria: BTreeMap<String, Option<String>>,
},
Score {
instructions: Value,
criteria: Vec<String>,
},
}Expand description
A typed question evaluated against the request state.
instructions may be a string, object or array. Reference nested state with
backticked paths such as `rows[3].country`.
Variants§
Noul
Yes/no. Answered with the probability of “yes”.
Choice
One option out of a defined set (at most 255). Answered with the chosen option and the probability of every option.
Fields
Score
A position along an ordered rubric of at least two levels.
Implementations§
Source§impl Question
impl Question
Sourcepub fn noul(instructions: impl Into<Value>) -> Self
pub fn noul(instructions: impl Into<Value>) -> Self
A yes/no question without criteria descriptions.
Sourcepub fn noul_with_criteria(
instructions: impl Into<Value>,
yes: impl Into<String>,
no: impl Into<String>,
) -> Self
pub fn noul_with_criteria( instructions: impl Into<Value>, yes: impl Into<String>, no: impl Into<String>, ) -> Self
A yes/no question with descriptions of what yes and no mean.
Sourcepub fn choice<K, V>(
instructions: impl Into<Value>,
options: impl IntoIterator<Item = (K, Option<V>)>,
) -> Self
pub fn choice<K, V>( instructions: impl Into<Value>, options: impl IntoIterator<Item = (K, Option<V>)>, ) -> Self
Pick one of options. Each option is (name, optional description).
Sourcepub fn choice_plain<K: Into<String>>(
instructions: impl Into<Value>,
options: impl IntoIterator<Item = K>,
) -> Self
pub fn choice_plain<K: Into<String>>( instructions: impl Into<Value>, options: impl IntoIterator<Item = K>, ) -> Self
Pick one of options, none of which carries a description.
Trait Implementations§
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
Mutably borrows from an owned value. Read more