pub struct CompositeRule<T>where
T: ?Sized,{ /* private fields */ }Expand description
A composite rule that combines multiple rules.
Implementations§
Source§impl<T> CompositeRule<T>where
T: ?Sized,
impl<T> CompositeRule<T>where
T: ?Sized,
Sourcepub fn new() -> CompositeRule<T>
pub fn new() -> CompositeRule<T>
Create a new composite rule.
Sourcepub fn push_rule(self, rule: impl Rule<T> + 'static) -> CompositeRule<T>
pub fn push_rule(self, rule: impl Rule<T> + 'static) -> CompositeRule<T>
Add a rule to this composite.
Trait Implementations§
Source§impl<T> Default for CompositeRule<T>where
T: ?Sized,
impl<T> Default for CompositeRule<T>where
T: ?Sized,
Source§fn default() -> CompositeRule<T>
fn default() -> CompositeRule<T>
Returns the “default value” for a type. Read more
Source§impl<T> Rule<T> for CompositeRule<T>
impl<T> Rule<T> for CompositeRule<T>
Source§fn validate(
&self,
value: &T,
ctx: &ValidationContext,
) -> Result<(), ValidationErrors>
fn validate( &self, value: &T, ctx: &ValidationContext, ) -> Result<(), ValidationErrors>
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<T> Freeze for CompositeRule<T>where
T: ?Sized,
impl<T> !RefUnwindSafe for CompositeRule<T>
impl<T> Send for CompositeRule<T>where
T: ?Sized,
impl<T> Sync for CompositeRule<T>where
T: ?Sized,
impl<T> Unpin for CompositeRule<T>where
T: ?Sized,
impl<T> !UnwindSafe for CompositeRule<T>
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