pub struct PredicateRefAtom<P> { /* private fields */ }Expand description
Tool that matches characters which satisfies the provided ref predicate.
See also PredicateAtom.
use minparser::prelude::*;
let lt = MatchHelper::from("aB1৬");
lt.match_atom(PredicateRefAtom::new(char::is_ascii_lowercase)).unwrap()
.match_atom(PredicateRefAtom::new(char::is_ascii_uppercase)).unwrap()
.match_atom(PredicateRefAtom::new(char::is_ascii_digit)).unwrap()
.match_atom(PredicateAtom::new(char::is_numeric)).unwrap();Implementations§
Source§impl<P: Fn(&char) -> bool> PredicateRefAtom<P>
impl<P: Fn(&char) -> bool> PredicateRefAtom<P>
Sourcepub const fn new(predicate: P) -> Self
pub const fn new(predicate: P) -> Self
Create a new PredicateRefAtom from a predicate.
Sourcepub const fn new_zero_or_more(predicate: P) -> RepeatAnyAtom<Self, TrueAtom>
pub const fn new_zero_or_more(predicate: P) -> RepeatAnyAtom<Self, TrueAtom>
Creates an atom that matches zero or more occurrences of characters that satisfy the specified predicate.
Sourcepub const fn new_one_or_more(predicate: P) -> RepeatAtom<Self, TrueAtom>
pub const fn new_one_or_more(predicate: P) -> RepeatAtom<Self, TrueAtom>
Creates an atom that matches one or more occurrences of characters that satisfy the specified predicate.
Trait Implementations§
Source§impl<P: Clone> Clone for PredicateRefAtom<P>
impl<P: Clone> Clone for PredicateRefAtom<P>
Source§fn clone(&self) -> PredicateRefAtom<P>
fn clone(&self) -> PredicateRefAtom<P>
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 moreSource§impl<P: Debug> Debug for PredicateRefAtom<P>
impl<P: Debug> Debug for PredicateRefAtom<P>
impl<P: Copy> Copy for PredicateRefAtom<P>
Auto Trait Implementations§
impl<P> Freeze for PredicateRefAtom<P>where
P: Freeze,
impl<P> RefUnwindSafe for PredicateRefAtom<P>where
P: RefUnwindSafe,
impl<P> Send for PredicateRefAtom<P>where
P: Send,
impl<P> Sync for PredicateRefAtom<P>where
P: Sync,
impl<P> Unpin for PredicateRefAtom<P>where
P: Unpin,
impl<P> UnwindSafe for PredicateRefAtom<P>where
P: 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