Skip to main content

QuestionnaireState

Struct QuestionnaireState 

Source
pub struct QuestionnaireState { /* private fields */ }
Expand description

Owns questionnaire answers, validation, navigation and focus state.

Implementations§

Source§

impl QuestionnaireState

Source

pub fn new( items: Vec<QuestionnaireItemDefinition>, cx: &mut Context<'_, Self>, ) -> Result<Self, QuestionnaireSchemaError>

Source

pub fn with_current_item( self, name: impl Into<SharedString>, ) -> Result<Self, QuestionnaireSchemaError>

Source

pub fn with_shortcuts(self, mode: QuestionnaireShortcutMode) -> Self

Source

pub fn current_item(&self) -> Option<&SharedString>

Source

pub fn current_ix(&self) -> Option<usize>

Source

pub fn total(&self) -> usize

Source

pub fn progress(&self) -> QuestionnaireProgressState

Source

pub fn item_definition( &self, name: &str, ) -> Option<&QuestionnaireItemDefinition>

Source

pub fn choice_definition( &self, item: &str, value: &str, ) -> Option<&QuestionnaireChoiceDefinition>

Source

pub fn item_state(&self, name: &str) -> Option<QuestionnaireItemState>

Source

pub fn choice_state( &self, item: &str, value: &str, ) -> Option<QuestionnaireChoiceState>

Source

pub fn choice_position(&self, item: &str, value: &str) -> Option<(usize, usize)>

One-based position of a choice among its item’s enabled choices, with the enabled total. Assistive technology announces the pair.

Source

pub fn navigation_state(&self) -> QuestionnaireNavigationState

Source

pub fn answer(&self, name: &str) -> Option<QuestionnaireAnswer>

Source

pub fn answers(&self) -> QuestionnaireAnswers

Source

pub fn error(&self, name: &str) -> Option<&QuestionnaireValidationError>

The active validation failure for an item, if any. Base reports the reason; the presentation layer turns a built-in reason into text.

Source

pub fn is_complete(&self) -> bool

Source

pub fn input_state(&self, name: &str) -> Option<Entity<InputState>>

Source

pub fn focus_handle(&self) -> &FocusHandle

Source

pub fn item_focus_handle(&self, name: &str) -> Option<&FocusHandle>

Source

pub fn choice_focus_handle( &self, item: &str, value: &str, ) -> Option<&FocusHandle>

Source

pub fn is_current_input_focused(&self, window: &Window) -> bool

Source

pub fn current_input_has_text(&self, cx: &App) -> bool

Whether the active item’s freeform input currently holds text. The skin needs it to decide whether an arrow key moves focus or edits the draft.

Source

pub fn focused_current_choice(&self, window: &Window) -> Option<&SharedString>

Source

pub fn shortcut_mode(&self) -> Option<QuestionnaireShortcutMode>

Source

pub fn shortcut_for_choice( &self, item: &str, value: &str, ) -> Option<SharedString>

Source

pub fn choice_for_shortcut( &self, item: &str, key: &str, ) -> Option<&SharedString>

Source

pub fn activate_shortcut( &mut self, key: &str, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool

Source

pub fn set_current_item( &mut self, name: &str, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Result<(), QuestionnaireSchemaError>

Source

pub fn set_answer( &mut self, item: &str, answer: QuestionnaireAnswer, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Result<(), QuestionnaireSchemaError>

Source

pub fn set_input_value( &mut self, item: &str, value: impl Into<SharedString>, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Result<(), QuestionnaireSchemaError>

Source

pub fn set_item_disabled( &mut self, name: &str, disabled: bool, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Result<(), QuestionnaireSchemaError>

Source

pub fn set_choice_disabled( &mut self, item: &str, value: &str, disabled: bool, cx: &mut Context<'_, Self>, ) -> Result<(), QuestionnaireSchemaError>

Source

pub fn set_external_error( &mut self, item: &str, error: impl Into<SharedString>, cx: &mut Context<'_, Self>, ) -> Result<(), QuestionnaireSchemaError>

Source

pub fn clear_external_error( &mut self, item: &str, cx: &mut Context<'_, Self>, ) -> Result<(), QuestionnaireSchemaError>

Source

pub fn reset(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)

Source

pub fn activate_choice( &mut self, item: &str, value: &str, cx: &mut Context<'_, Self>, ) -> Result<(), QuestionnaireSchemaError>

Source

pub fn confirm_current( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool

Source

pub fn go_previous( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool

Source

pub fn go_next( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool

Source

pub fn skip_current( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool

Source

pub fn submit( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool

Source

pub fn focus_current_item(&self, window: &mut Window, cx: &mut App) -> bool

Source

pub fn focus_invalid_item( &self, item: &str, window: &mut Window, cx: &mut App, ) -> bool

Source

pub fn focus_choice( &self, item: &str, value: &str, window: &mut Window, cx: &mut App, ) -> bool

Source

pub fn focus_input(&self, item: &str, window: &mut Window, cx: &mut App) -> bool

Source

pub fn focus_previous_answer( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool

Source

pub fn focus_next_answer( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool

Source

pub fn move_current_radio( &mut self, direction: isize, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more