pub struct TypedDecisionResponse<S: AnswerSchema = DynamicSchema> { /* private fields */ }Expand description
Validated response retaining request keys and an optional named answer shape.
Implementations§
Source§impl<S: AnswerSchema> TypedDecisionResponse<S>
impl<S: AnswerSchema> TypedDecisionResponse<S>
Sourcepub fn raw(&self) -> &DecisionResponse
pub fn raw(&self) -> &DecisionResponse
Native response, borrowed immutably for extension fields.
Sourcepub fn answers(&self) -> Result<S::Answers<'_>, Error>
pub fn answers(&self) -> Result<S::Answers<'_>, Error>
Borrow named fields inferred by crate::questions!, or a map for dynamic questions.
The normal macro-generated schema has already been validated before the client returns.
Sourcepub fn answer(&self, id: &str) -> Result<AnswerResult<'_>, Error>
pub fn answer(&self, id: &str) -> Result<AnswerResult<'_>, Error>
Look up a checked answer by its request key. Match the enum for dynamic heterogeneous keys.
Sourcepub fn choice(&self, id: &str) -> Result<ChoiceAnswer<'_>, Error>
pub fn choice(&self, id: &str) -> Result<ChoiceAnswer<'_>, Error>
Look up a choice answer by key; a different question kind is an error.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for TypedDecisionResponse<S>where
S: Freeze,
impl<S> RefUnwindSafe for TypedDecisionResponse<S>where
S: RefUnwindSafe,
impl<S> Send for TypedDecisionResponse<S>where
S: Send,
impl<S> Sync for TypedDecisionResponse<S>where
S: Sync,
impl<S> Unpin for TypedDecisionResponse<S>where
S: Unpin,
impl<S> UnsafeUnpin for TypedDecisionResponse<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for TypedDecisionResponse<S>where
S: UnwindSafe,
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