pub struct PrefixRule {
pub prefix: String,
pub case_insensitive: bool,
pub message: Option<String>,
}Expand description
Prefix validation rule - string must start with a prefix.
Fields§
§prefix: StringThe prefix to match
case_insensitive: boolCase insensitive matching
message: Option<String>Custom error message
Implementations§
Trait Implementations§
Source§impl Clone for PrefixRule
impl Clone for PrefixRule
Source§fn clone(&self) -> PrefixRule
fn clone(&self) -> PrefixRule
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 PrefixRule
impl Debug for PrefixRule
Source§impl Rule<String> for PrefixRule
impl Rule<String> for PrefixRule
Source§fn validate(
&self,
value: &String,
ctx: &ValidationContext,
) -> ValidationResult<()>
fn validate( &self, value: &String, ctx: &ValidationContext, ) -> ValidationResult<()>
Validate the value.
Source§fn default_message(&self) -> String
fn default_message(&self) -> String
Get the default error message.
Source§fn validate_at(
&self,
value: &T,
path: &FieldPath,
ctx: &ValidationContext,
) -> Result<(), ValidationErrors>
fn validate_at( &self, value: &T, path: &FieldPath, ctx: &ValidationContext, ) -> Result<(), ValidationErrors>
Validate the value with a field path for error reporting.
Source§fn error_code(&self) -> String
fn error_code(&self) -> String
Get the error code.
Source§fn is_transform(&self) -> bool
fn is_transform(&self) -> bool
Check if this rule is a transformation (not validation).
Source§impl Rule<str> for PrefixRule
impl Rule<str> for PrefixRule
Source§fn validate(
&self,
value: &str,
_ctx: &ValidationContext,
) -> ValidationResult<()>
fn validate( &self, value: &str, _ctx: &ValidationContext, ) -> ValidationResult<()>
Validate the value.
Source§fn default_message(&self) -> String
fn default_message(&self) -> String
Get the default error message.
Source§fn validate_at(
&self,
value: &T,
path: &FieldPath,
ctx: &ValidationContext,
) -> Result<(), ValidationErrors>
fn validate_at( &self, value: &T, path: &FieldPath, ctx: &ValidationContext, ) -> Result<(), ValidationErrors>
Validate the value with a field path for error reporting.
Source§fn error_code(&self) -> String
fn error_code(&self) -> String
Get the error code.
Source§fn is_transform(&self) -> bool
fn is_transform(&self) -> bool
Check if this rule is a transformation (not validation).
Auto Trait Implementations§
impl Freeze for PrefixRule
impl RefUnwindSafe for PrefixRule
impl Send for PrefixRule
impl Sync for PrefixRule
impl Unpin for PrefixRule
impl UnwindSafe for PrefixRule
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