pub enum Constraint {
MinI64(i64),
MaxI64(i64),
MinU64(u64),
MaxU64(u64),
MinF64(f64),
MaxF64(f64),
MinLength(u64),
MaxLength(u64),
Regex(String),
Email,
Url,
NonEmpty,
}Expand description
Declarative constraint on a field (0.6+). Evaluated on insert after type checks.
Variants§
MinI64(i64)
Minimum inclusive for signed integers (Int64).
MaxI64(i64)
Maximum inclusive for signed integers (Int64).
MinU64(u64)
Minimum inclusive for unsigned integers (Uint64).
MaxU64(u64)
Maximum inclusive for unsigned integers (Uint64).
MinF64(f64)
Minimum inclusive for floats (Float64).
MaxF64(f64)
Maximum inclusive for floats (Float64).
MinLength(u64)
Minimum UTF-8 byte length (String) or element count (List).
MaxLength(u64)
Maximum UTF-8 byte length (String) or element count (List).
Regex(String)
Rust regex syntax (applied to String).
Loose email shape check (String).
Url
http/https URL prefix check (String).
NonEmpty
Non-empty string, bytes, or list.
Trait Implementations§
Source§impl Clone for Constraint
impl Clone for Constraint
Source§fn clone(&self) -> Constraint
fn clone(&self) -> Constraint
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 moreSource§impl Debug for Constraint
impl Debug for Constraint
Source§impl PartialEq for Constraint
impl PartialEq for Constraint
Source§fn eq(&self, other: &Constraint) -> bool
fn eq(&self, other: &Constraint) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Constraint
Auto Trait Implementations§
impl Freeze for Constraint
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnsafeUnpin for Constraint
impl UnwindSafe for Constraint
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