#[non_exhaustive]pub struct Answer {
pub kind: QuestionType,
pub noul: Option<Number>,
pub choice: Option<String>,
pub score: Option<Number>,
pub legend: Option<IndexMap<String, Value>>,
pub probabilities: Option<IndexMap<String, Number>>,
pub confidence: Option<Number>,
pub extra: IndexMap<String, Value>,
}Expand description
One answer, the provider’s answer object as returned. Which members are present depends on the question type:
noul:{type, noul}.noulis the probability that the answer is yes, from 0 (no) to 1 (yes).choice:{type, choice, probabilities, confidence}.score:{type, score, legend, probabilities, confidence}.scoreis fractional, from 0 to levels - 1, and can land between levels;legendandprobabilitiesare keyed by the level index as a string.
Numbers are Numbers, so an integer stays an integer, and a member
the provider adds that this crate does not name is kept in
Answer::extra. A reply decodes open: an answer of a type this crate
does not name keeps its type string, and every member is kept as given.
The runner never rounds, rescales or renames them.
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§noul: Option<Number>§choice: Option<String>§score: Option<Number>§legend: Option<IndexMap<String, Value>>§probabilities: Option<IndexMap<String, Number>>§confidence: Option<Number>§extra: IndexMap<String, Value>Members the provider returned that this crate does not name, kept in the order they came.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Answer
impl<'de> Deserialize<'de> for Answer
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 Answer
Auto Trait Implementations§
impl Freeze for Answer
impl RefUnwindSafe for Answer
impl Send for Answer
impl Sync for Answer
impl Unpin for Answer
impl UnsafeUnpin for Answer
impl UnwindSafe for Answer
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