pub enum InputFilter {
MaxLength(usize),
CharClass(Arc<dyn Fn(char) -> bool + Send + Sync>),
}Expand description
One input filter — see the module-section doc above for why this is
a separate concept from rosace_forms::Validator.
Variants§
MaxLength(usize)
Reject any edit that would push the value’s CHAR count past n
(truncates from the end).
CharClass(Arc<dyn Fn(char) -> bool + Send + Sync>)
Keep only characters for which the predicate returns true.
Implementations§
Source§impl InputFilter
impl InputFilter
pub fn max_length(n: usize) -> Self
pub fn char_class(f: impl Fn(char) -> bool + Send + Sync + 'static) -> Self
Sourcepub fn alphanumeric() -> Self
pub fn alphanumeric() -> Self
Convenience: letters and digits only.
Trait Implementations§
Source§impl Clone for InputFilter
impl Clone for InputFilter
Source§fn clone(&self) -> InputFilter
fn clone(&self) -> InputFilter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 !RefUnwindSafe for InputFilter
impl !UnwindSafe for InputFilter
impl Freeze for InputFilter
impl Send for InputFilter
impl Sync for InputFilter
impl Unpin for InputFilter
impl UnsafeUnpin for InputFilter
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