pub struct FormState {
pub fields: Vec<FormField>,
pub focused: usize,
/* private fields */
}Expand description
State for the render_form widget.
Fields§
§fields: Vec<FormField>The form fields.
focused: usizeIndex of the currently focused field.
Implementations§
Source§impl FormState
impl FormState
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Move focus to the next field, stopping at the last.
Sourcepub fn focus_prev(&mut self)
pub fn focus_prev(&mut self)
Move focus to the previous field, stopping at the first.
Sourcepub fn handle_key(&mut self, key: KeyEvent) -> FormEvent
pub fn handle_key(&mut self, key: KeyEvent) -> FormEvent
Handle a key event, updating internal state and returning a FormEvent.
Sourcepub fn into_fields(self) -> Vec<FormField>
pub fn into_fields(self) -> Vec<FormField>
Consume the state and return the fields with their current input values.
Auto Trait Implementations§
impl Freeze for FormState
impl RefUnwindSafe for FormState
impl Send for FormState
impl Sync for FormState
impl Unpin for FormState
impl UnsafeUnpin for FormState
impl UnwindSafe for FormState
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> 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