pub enum SerializableRule {
Email {
message: Option<String>,
},
Length {
min: Option<usize>,
max: Option<usize>,
message: Option<String>,
},
Range {
min: Option<f64>,
max: Option<f64>,
message: Option<String>,
},
Regex {
pattern: String,
message: Option<String>,
},
Url {
message: Option<String>,
},
Required {
message: Option<String>,
},
AsyncUnique {
table: String,
column: String,
message: Option<String>,
},
AsyncExists {
table: String,
column: String,
message: Option<String>,
},
AsyncApi {
endpoint: String,
message: Option<String>,
},
}Expand description
Wrapper for serializable validation rules.
This enum allows rules to be serialized/deserialized for configuration files and pretty-printing.
Variants§
Email format validation
Length
String length validation
Range
Numeric range validation
Regex
Regex pattern validation
Url
URL format validation
Required
Required (non-empty) validation
AsyncUnique
Database uniqueness check (async)
AsyncExists
Database existence check (async)
AsyncApi
External API validation (async)
Implementations§
Trait Implementations§
Source§impl Clone for SerializableRule
impl Clone for SerializableRule
Source§fn clone(&self) -> SerializableRule
fn clone(&self) -> SerializableRule
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 SerializableRule
impl Debug for SerializableRule
Source§impl<'de> Deserialize<'de> for SerializableRule
impl<'de> Deserialize<'de> for SerializableRule
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<AsyncApiRule> for SerializableRule
impl From<AsyncApiRule> for SerializableRule
Source§fn from(rule: AsyncApiRule) -> Self
fn from(rule: AsyncApiRule) -> Self
Converts to this type from the input type.
Source§impl From<AsyncExistsRule> for SerializableRule
impl From<AsyncExistsRule> for SerializableRule
Source§fn from(rule: AsyncExistsRule) -> Self
fn from(rule: AsyncExistsRule) -> Self
Converts to this type from the input type.
Source§impl From<AsyncUniqueRule> for SerializableRule
impl From<AsyncUniqueRule> for SerializableRule
Source§fn from(rule: AsyncUniqueRule) -> Self
fn from(rule: AsyncUniqueRule) -> Self
Converts to this type from the input type.
Source§impl From<EmailRule> for SerializableRule
impl From<EmailRule> for SerializableRule
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 From<RegexRule> for SerializableRule
impl From<RegexRule> for SerializableRule
Source§impl From<RequiredRule> for SerializableRule
impl From<RequiredRule> for SerializableRule
Source§fn from(rule: RequiredRule) -> Self
fn from(rule: RequiredRule) -> Self
Converts to this type from the input type.
Source§impl From<UrlRule> for SerializableRule
impl From<UrlRule> for SerializableRule
Source§impl PartialEq for SerializableRule
impl PartialEq for SerializableRule
Source§impl Serialize for SerializableRule
impl Serialize for SerializableRule
impl StructuralPartialEq for SerializableRule
Auto Trait Implementations§
impl Freeze for SerializableRule
impl RefUnwindSafe for SerializableRule
impl Send for SerializableRule
impl Sync for SerializableRule
impl Unpin for SerializableRule
impl UnwindSafe for SerializableRule
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