#[non_exhaustive]pub struct Question {
pub kind: QuestionType,
pub instructions: Value,
pub criteria: Option<Criteria>,
}Expand description
One question: {type, instructions, criteria?}.
Non-exhaustive so later optional members are additive: use
Question::noul, Question::choice or Question::score and the
with_* setters, or decode one.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: QuestionType§instructions: ValueA non-empty string, or an object or array.
criteria: Option<Criteria>Implementations§
Source§impl Question
impl Question
pub fn new(kind: QuestionType, instructions: impl Into<Value>) -> Self
Sourcepub fn choice(
instructions: impl Into<Value>,
options: IndexMap<String, Value>,
) -> Self
pub fn choice( instructions: impl Into<Value>, options: IndexMap<String, Value>, ) -> Self
A choice question over options, in order.
Sourcepub fn score(instructions: impl Into<Value>, levels: Vec<Value>) -> Self
pub fn score(instructions: impl Into<Value>, levels: Vec<Value>) -> Self
A score question over levels, lowest first.
pub fn with_criteria(self, criteria: Criteria) -> Self
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>,
Deserialize this value from the given Serde deserializer. Read more
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