pub struct Trimmed;Expand description
Accepts strings with no leading or trailing whitespace.
Useful for rejecting un-normalized input before it is stored. Whitespace is
defined by char::is_whitespace via str::trim.
§Examples
use type_lib::rules::Trimmed;
use type_lib::Validator;
assert!(Trimmed::validate("clean").is_ok());
assert!(Trimmed::validate(" padded ").is_err());
assert!(Trimmed::validate("trailing\n").is_err());Trait Implementations§
Auto Trait Implementations§
impl Freeze for Trimmed
impl RefUnwindSafe for Trimmed
impl Send for Trimmed
impl Sync for Trimmed
impl Unpin for Trimmed
impl UnsafeUnpin for Trimmed
impl UnwindSafe for Trimmed
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