pub struct Form { /* private fields */ }Expand description
A form containing multiple groups of fields.
Implementations§
Source§impl Form
impl Form
Sourcepub fn show_help(self, show: bool) -> Self
pub fn show_help(self, show: bool) -> Self
Sets whether to show help at the bottom of the form.
Sourcepub fn show_errors(self, show: bool) -> Self
pub fn show_errors(self, show: bool) -> Self
Sets whether to show validation errors.
Sourcepub fn with_accessible(self, accessible: bool) -> Self
pub fn with_accessible(self, accessible: bool) -> Self
Enables or disables accessible mode.
When accessible mode is enabled, the form renders in a more screen-reader-friendly format with simpler styling and clearer field labels. This mode prioritizes accessibility over visual aesthetics.
§Example
ⓘ
use huh::Form;
let form = Form::new(groups)
.with_accessible(true);Sourcepub fn is_accessible(&self) -> bool
pub fn is_accessible(&self) -> bool
Returns whether accessible mode is enabled.
Sourcepub fn current_group(&self) -> usize
pub fn current_group(&self) -> usize
Returns the current group index.
Sourcepub fn get_value(&self, key: &str) -> Option<Box<dyn Any>>
pub fn get_value(&self, key: &str) -> Option<Box<dyn Any>>
Returns the value of a field by key.
Sourcepub fn get_string(&self, key: &str) -> Option<String>
pub fn get_string(&self, key: &str) -> Option<String>
Returns the string value of a field by key.
Sourcepub fn all_errors(&self) -> Vec<String>
pub fn all_errors(&self) -> Vec<String>
Collects all validation errors from all groups.
Sourcepub fn group_width(&self, group_index: usize) -> usize
pub fn group_width(&self, group_index: usize) -> usize
Returns the width allocated to a specific group based on the current layout.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Form
impl !RefUnwindSafe for Form
impl Send for Form
impl Sync for Form
impl Unpin for Form
impl !UnwindSafe for Form
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