[−][src]Enum es_htmlform::types::Constraint
Constraints on Field values, perform validation.
All of the constraints cause server-side validation to be performed,
all except Constraint::Func should - assuming they're serialized
properly - result in client-side validation. HTML validity is checked
when adding the constraints to the fields using HtmlForm's builder
methods.
Variants
MinLength(usize)Constraint on most inputs.
MaxLength(usize)Constraint on most inputs.
MinNumber(f64)Constraint on number and range inputs.
MaxNumber(f64)Constraint on number and range inputs.
MinDate(&'a str)Constraint on date input.
MaxDate(&'a str)Constraint on date input.
MinDateTime(&'a str)Constraint on datetime-local input.
MaxDateTime(&'a str)Constraint on datetime-local input.
MinTime(&'a str)Constraint on time input.
MaxTime(&'a str)Constraint on time input.
Pattern(&'a str)Constraint on most Element::Input fields, causes regex pattern
validation (both on the server and the client, note that the pattern
therefore must execute correctly on both sides).
Constraint on any field, is executed server-side only and not serialized.
Methods
impl<'a> Constraint<'a>[src]
pub fn validate(&self, formvalue: &Value) -> Result<(), ValidationError>[src]
Validate a single, non-empty Value.
pub fn attrpair(&self) -> Option<(String, String)>[src]
Returns the name and value of the HTML attribute of the Constraint.
Returns None for Constraint::Func, as that is only functional on
the server side.
pub fn allowed_on(&self, element: &Element) -> bool[src]
Return true if this Constraint is allowed on element,
false otherwise.
Trait Implementations
Auto Trait Implementations
impl<'a> !Send for Constraint<'a>
impl<'a> !Sync for Constraint<'a>
impl<'a> Unpin for Constraint<'a>
impl<'a> !UnwindSafe for Constraint<'a>
impl<'a> !RefUnwindSafe for Constraint<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,