pub struct LengthRule {
pub min: Option<usize>,
pub max: Option<usize>,
pub message: Option<String>,
}Expand description
String length validation rule.
Validates that a string’s length is within specified bounds.
Fields§
§min: Option<usize>Minimum length (inclusive)
max: Option<usize>Maximum length (inclusive)
message: Option<String>Custom error message
Implementations§
Source§impl LengthRule
impl LengthRule
Sourcepub fn with_message(self, message: impl Into<String>) -> Self
pub fn with_message(self, message: impl Into<String>) -> Self
Set a custom error message.
Trait Implementations§
Source§impl Clone for LengthRule
impl Clone for LengthRule
Source§fn clone(&self) -> LengthRule
fn clone(&self) -> LengthRule
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 LengthRule
impl Debug for LengthRule
Source§impl<'de> Deserialize<'de> for LengthRule
impl<'de> Deserialize<'de> for LengthRule
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
Source§impl From<LengthRule> for SerializableRule
impl From<LengthRule> for SerializableRule
Source§fn from(rule: LengthRule) -> Self
fn from(rule: LengthRule) -> Self
Converts to this type from the input type.
Source§impl PartialEq for LengthRule
impl PartialEq for LengthRule
Source§impl Serialize for LengthRule
impl Serialize for LengthRule
Source§impl ValidationRule<String> for LengthRule
impl ValidationRule<String> for LengthRule
Source§impl ValidationRule<str> for LengthRule
impl ValidationRule<str> for LengthRule
impl StructuralPartialEq for LengthRule
Auto Trait Implementations§
impl Freeze for LengthRule
impl RefUnwindSafe for LengthRule
impl Send for LengthRule
impl Sync for LengthRule
impl Unpin for LengthRule
impl UnwindSafe for LengthRule
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