#[repr(C)]pub struct ValidityState {
pub flags: u32,
}Expand description
Every constraint one control failed, at once.
A SET and not a single reason, because HTML’s ValidityState is a set:
one field can be both too short and out of range, and reporting only the
first would make the second appear only after the first was fixed.
A bitset rather than a struct of bools so that appending a reason - the
PatternMismatch 11b-i-b added - stays a pure enum append with no
change to this type’s layout. The same trade GamepadState::buttons makes.
Fields§
§flags: u32Bit n set means the ValidityReason with discriminant n failed.
Read it through Self::has rather than by hand.
Implementations§
Source§impl ValidityState
impl ValidityState
Sourcepub const fn has(self, reason: ValidityReason) -> bool
pub const fn has(self, reason: ValidityReason) -> bool
Did this control fail reason?
Sourcepub const fn insert(&mut self, reason: ValidityReason)
pub const fn insert(&mut self, reason: ValidityReason)
Record a failure.
Trait Implementations§
Source§impl Clone for ValidityState
impl Clone for ValidityState
Source§fn clone(&self) -> ValidityState
fn clone(&self) -> ValidityState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ValidityState
Source§impl Debug for ValidityState
impl Debug for ValidityState
Source§impl Default for ValidityState
impl Default for ValidityState
Source§fn default() -> ValidityState
fn default() -> ValidityState
Returns the “default value” for a type. Read more
impl Eq for ValidityState
Source§impl Hash for ValidityState
impl Hash for ValidityState
Source§impl Ord for ValidityState
impl Ord for ValidityState
Source§fn cmp(&self, other: &ValidityState) -> Ordering
fn cmp(&self, other: &ValidityState) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ValidityState
impl PartialEq for ValidityState
Source§impl PartialOrd for ValidityState
impl PartialOrd for ValidityState
impl StructuralPartialEq for ValidityState
Auto Trait Implementations§
impl Freeze for ValidityState
impl RefUnwindSafe for ValidityState
impl Send for ValidityState
impl Sync for ValidityState
impl Unpin for ValidityState
impl UnsafeUnpin for ValidityState
impl UnwindSafe for ValidityState
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