pub enum AnswerState {
SingleChoice {
selected: Option<String>,
other_text: TextArea<'static>,
},
MultiChoice {
selected: HashSet<String>,
other_text: TextArea<'static>,
},
FreeText {
textarea: TextArea<'static>,
},
}Expand description
Answer state for a single question
Variants§
Implementations§
Source§impl AnswerState
impl AnswerState
Sourcepub fn from_question(question: &Question) -> Self
pub fn from_question(question: &Question) -> Self
Create answer state from a question
Sourcepub fn is_selected(&self, choice_id: &str) -> bool
pub fn is_selected(&self, choice_id: &str) -> bool
Check if a choice is selected
Sourcepub fn select_choice(&mut self, choice_id: &str)
pub fn select_choice(&mut self, choice_id: &str)
Toggle/select a choice
Sourcepub fn textarea_mut(&mut self) -> Option<&mut TextArea<'static>>
pub fn textarea_mut(&mut self) -> Option<&mut TextArea<'static>>
Get the textarea for this answer (if applicable)
Sourcepub fn has_other_text(&self) -> bool
pub fn has_other_text(&self) -> bool
Check if “Other” has text
Sourcepub fn has_answer(&self) -> bool
pub fn has_answer(&self) -> bool
Check if this answer has a valid response (selected choice or text entered)
Auto Trait Implementations§
impl !Freeze for AnswerState
impl RefUnwindSafe for AnswerState
impl Send for AnswerState
impl Sync for AnswerState
impl Unpin for AnswerState
impl UnwindSafe for AnswerState
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more