Skip to main content

ReadAnswer

Trait ReadAnswer 

Source
pub trait ReadAnswer {
    type Output<'a>;

    // Required method
    fn read<'a>(
        id: &str,
        answer: &'a Answer,
    ) -> Result<Self::Output<'a>, AnswerError>;
}
Expand description

How the answer behind a QuestionKey is read from a response.

Implemented for NoulAnswer, ChoiceAnswer, ScoreAnswer, Answer, TypedChoice and ValueChoice. Implement it for your own question types together with IntoQuestion.

Required Associated Types§

Source

type Output<'a>

What SystemOneResponse::answer returns for this key.

Required Methods§

Source

fn read<'a>( id: &str, answer: &'a Answer, ) -> Result<Self::Output<'a>, AnswerError>

Reads the answer to question id, failing when it has the wrong kind or content.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§