pub enum ElicitOutcome {
Answered(Value),
Declined {
reason: String,
},
}Expand description
What came back.
Variants§
Answered(Value)
A human answered. The shape is ElicitKind’s to define.
Declined
Nobody answered, or the answer was no. Always carries a reason: a caller that has to explain a refusal to a model, a log or a user should never have to invent one.
Implementations§
Source§impl ElicitOutcome
impl ElicitOutcome
Sourcepub fn answered<T: Serialize>(answer: &T) -> Self
pub fn answered<T: Serialize>(answer: &T) -> Self
An answer, from whatever type the request’s kind calls for.
pub fn declined(reason: impl Into<String>) -> Self
Sourcepub fn answer_as<T: DeserializeOwned>(&self) -> Option<T>
pub fn answer_as<T: DeserializeOwned>(&self) -> Option<T>
Read the answer as the type this request’s kind defines.
None for a decline and for an answer that does not parse — a
caller cannot act on an answer it does not understand, and guessing
would be guessing about consent.
Sourcepub fn decline_reason(&self) -> Option<&str>
pub fn decline_reason(&self) -> Option<&str>
The reason a question went unanswered, for a caller reporting it.
Trait Implementations§
Source§impl Clone for ElicitOutcome
impl Clone for ElicitOutcome
Source§impl Debug for ElicitOutcome
impl Debug for ElicitOutcome
Source§impl PartialEq for ElicitOutcome
impl PartialEq for ElicitOutcome
impl StructuralPartialEq for ElicitOutcome
Auto Trait Implementations§
impl Forget for ElicitOutcome
impl Freeze for ElicitOutcome
impl Move for ElicitOutcome
impl RefUnwindSafe for ElicitOutcome
impl Send for ElicitOutcome
impl Sync for ElicitOutcome
impl Unpin for ElicitOutcome
impl UnsafeUnpin for ElicitOutcome
impl UnwindSafe for ElicitOutcome
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