pub struct ValueConstraints {
pub min: Option<f64>,
pub max: Option<f64>,
pub allowed_values: Option<Vec<String>>,
pub pattern: Option<String>,
pub custom_validator: Option<String>,
}Expand description
Value constraints
Fields§
§min: Option<f64>Minimum value
max: Option<f64>Maximum value
allowed_values: Option<Vec<String>>Allowed values
pattern: Option<String>Regular expression pattern for strings
custom_validator: Option<String>Custom validation function name
Implementations§
Source§impl ValueConstraints
impl ValueConstraints
Sourcepub fn with_range(self, min: f64, max: f64) -> Self
pub fn with_range(self, min: f64, max: f64) -> Self
Set range
Sourcepub fn with_allowed_values(self, values: Vec<String>) -> Self
pub fn with_allowed_values(self, values: Vec<String>) -> Self
Set allowed values
Sourcepub fn with_pattern(self, pattern: &str) -> Self
pub fn with_pattern(self, pattern: &str) -> Self
Set pattern for string validation
Trait Implementations§
Source§impl Clone for ValueConstraints
impl Clone for ValueConstraints
Source§fn clone(&self) -> ValueConstraints
fn clone(&self) -> ValueConstraints
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 ValueConstraints
impl Debug for ValueConstraints
Source§impl Default for ValueConstraints
impl Default for ValueConstraints
Source§impl<'de> Deserialize<'de> for ValueConstraints
impl<'de> Deserialize<'de> for ValueConstraints
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ValueConstraints
impl RefUnwindSafe for ValueConstraints
impl Send for ValueConstraints
impl Sync for ValueConstraints
impl Unpin for ValueConstraints
impl UnwindSafe for ValueConstraints
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more