Struct type_rules::rules::Validate
source · [−]pub struct Validate();
Expand description
Rule to check the rules of the inner type
Works with Option
, just return Ok(())
if it’s None
Example
use type_rules::rules::{MaxLength, MinLength, Validate, MinMaxLength};
use type_rules::Validator;
#[derive(Validator)]
struct Password(#[rule(MinLength(8))] String);
#[derive(Validator)]
struct User {
username: String,
#[rule(Validate())]
password: Password,
};
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Validate
impl Send for Validate
impl Sync for Validate
impl Unpin for Validate
impl UnwindSafe for Validate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more