pub struct Alphanumeric;Expand description
Accepts strings whose characters are all alphanumeric.
Uses the Unicode definition of alphanumeric (char::is_alphanumeric). An
empty string passes vacuously; combine with NonEmpty to
also require content.
§Examples
use type_lib::rules::Alphanumeric;
use type_lib::Validator;
assert!(Alphanumeric::validate("abc123").is_ok());
assert!(Alphanumeric::validate("abc 123").is_err()); // space
assert!(Alphanumeric::validate("user_name").is_err()); // underscoreTrait Implementations§
Auto Trait Implementations§
impl Freeze for Alphanumeric
impl RefUnwindSafe for Alphanumeric
impl Send for Alphanumeric
impl Sync for Alphanumeric
impl Unpin for Alphanumeric
impl UnsafeUnpin for Alphanumeric
impl UnwindSafe for Alphanumeric
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