pub struct FieldState {
pub value: String,
pub result: Option<ValidationResult>,
pub touched: bool,
pub dirty: bool,
pub errors: Vec<String>,
}Expand description
Field validation state.
Fields§
§value: StringCurrent value.
result: Option<ValidationResult>Validation result.
touched: boolWhether the field has been touched (focused then blurred).
dirty: boolWhether the field has been modified.
errors: Vec<String>Field-specific errors (from validators).
Implementations§
Source§impl FieldState
impl FieldState
Sourcepub fn with_value(value: &str) -> Self
pub fn with_value(value: &str) -> Self
Create with initial value.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Check if field has errors.
Sourcepub fn first_error(&self) -> Option<&str>
pub fn first_error(&self) -> Option<&str>
Get first error message.
Trait Implementations§
Source§impl Clone for FieldState
impl Clone for FieldState
Source§fn clone(&self) -> FieldState
fn clone(&self) -> FieldState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FieldState
impl Debug for FieldState
Source§impl Default for FieldState
impl Default for FieldState
Source§fn default() -> FieldState
fn default() -> FieldState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FieldState
impl RefUnwindSafe for FieldState
impl Send for FieldState
impl Sync for FieldState
impl Unpin for FieldState
impl UnwindSafe for FieldState
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