pub struct Answer<T = AnswerValue> { /* private fields */ }Expand description
A normalized answer. Undecided answers retain evidence and call metadata.
Implementations§
Source§impl<T> Answer<T>
impl<T> Answer<T>
Sourcepub fn decided(&self) -> bool
pub fn decided(&self) -> bool
Whether this answer is decided. False and zero are decided values.
Sourcepub fn confidence(&self) -> f64
pub fn confidence(&self) -> f64
Reported decision confidence.
Sourcepub fn probabilities(&self) -> &Probabilities
pub fn probabilities(&self) -> &Probabilities
Ordered probabilities, including for abstentions.
Sourcepub fn raw(&self) -> Option<&Value>
pub fn raw(&self) -> Option<&Value>
Optional private provider response data, excluded from Debug and wire encoding.
Source§impl Answer
impl Answer
Sourcepub fn revalidate(&self, question: &Question) -> Result<Self, Error>
pub fn revalidate(&self, question: &Question) -> Result<Self, Error>
Validate the retained provider candidate against the actual requested question. Existing abstentions remain undecided, including explicit provider abstentions.
§Errors
Returns the normalization errors from make_answer if the retained
candidate or distribution is incompatible with question.
Sourcepub fn typed<T: AnswerType>(&self) -> Result<Answer<T>, Error>
pub fn typed<T: AnswerType>(&self) -> Result<Answer<T>, Error>
Project into a typed answer, checking type even when the answer is undecided.
§Errors
Propagates conversion errors from AnswerType::from_answer_value,
including a type mismatch even when this answer is undecided.