pub struct GroupedRule<R> {
pub rule: R,
pub group: ValidationGroup,
}Expand description
A validation rule with an associated group.
Fields§
§rule: RThe validation rule
group: ValidationGroupThe group this rule belongs to
Implementations§
Source§impl<R> GroupedRule<R>
impl<R> GroupedRule<R>
Sourcepub fn new(rule: R, group: ValidationGroup) -> Self
pub fn new(rule: R, group: ValidationGroup) -> Self
Create a new grouped rule.
Sourcepub fn for_create(rule: R) -> Self
pub fn for_create(rule: R) -> Self
Create a rule for the Create group.
Sourcepub fn for_update(rule: R) -> Self
pub fn for_update(rule: R) -> Self
Create a rule for the Update group.
Sourcepub fn for_default(rule: R) -> Self
pub fn for_default(rule: R) -> Self
Create a rule for the Default group (applies to all).
Sourcepub fn applies_to(&self, group: &ValidationGroup) -> bool
pub fn applies_to(&self, group: &ValidationGroup) -> bool
Check if this rule should be applied for the given group.
Trait Implementations§
Source§impl<R: Clone> Clone for GroupedRule<R>
impl<R: Clone> Clone for GroupedRule<R>
Source§fn clone(&self) -> GroupedRule<R>
fn clone(&self) -> GroupedRule<R>
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 moreAuto Trait Implementations§
impl<R> Freeze for GroupedRule<R>where
R: Freeze,
impl<R> RefUnwindSafe for GroupedRule<R>where
R: RefUnwindSafe,
impl<R> Send for GroupedRule<R>where
R: Send,
impl<R> Sync for GroupedRule<R>where
R: Sync,
impl<R> Unpin for GroupedRule<R>where
R: Unpin,
impl<R> UnwindSafe for GroupedRule<R>where
R: UnwindSafe,
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