pub struct PredicateRefTool<P> { /* private fields */ }Expand description
Tool that matches characters which satisfies the provided ref predicate.
See also PredicateTool.
use minparser::tools::PredicateRefTool;
use minparser::tools::PredicateTool;
let lt = minparser::view::ViewFile::new_default("aB1৬");
lt.match_tool(PredicateRefTool::new(char::is_ascii_lowercase)).unwrap()
.match_tool(PredicateRefTool::new(char::is_ascii_uppercase)).unwrap()
.match_tool(PredicateRefTool::new(char::is_ascii_digit)).unwrap()
.match_tool(PredicateTool::new(char::is_numeric)).unwrap();Implementations§
Source§impl<P: Fn(&char) -> bool> PredicateRefTool<P>
impl<P: Fn(&char) -> bool> PredicateRefTool<P>
Sourcepub const fn new(predicate: P) -> Self
pub const fn new(predicate: P) -> Self
Create a new PredicateRefTool from a predicate.
Sourcepub const fn new_zero_or_more(predicate: P) -> RepeatTool<Self, TrueParser>
pub const fn new_zero_or_more(predicate: P) -> RepeatTool<Self, TrueParser>
Creates a tool that matches zero or more occurrences of characters that satisfy the specified predicate.
Sourcepub const fn new_one_or_more(predicate: P) -> RepeatTool<Self, TrueParser>
pub const fn new_one_or_more(predicate: P) -> RepeatTool<Self, TrueParser>
Creates a tool that matches one or more occurrences of characters that satisfy the specified predicate.
Trait Implementations§
Source§impl<P: Clone> Clone for PredicateRefTool<P>
impl<P: Clone> Clone for PredicateRefTool<P>
Source§fn clone(&self) -> PredicateRefTool<P>
fn clone(&self) -> PredicateRefTool<P>
Returns a copy 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 PredicateRefTool<P>
impl<P: Debug> Debug for PredicateRefTool<P>
Source§impl<'a, P: Fn(&char) -> bool> ParseToolData<'a, GetChar> for PredicateRefTool<P>
impl<'a, P: Fn(&char) -> bool> ParseToolData<'a, GetChar> for PredicateRefTool<P>
Source§impl<'a, P: Fn(&char) -> bool, D, F: Fn(char) -> D> ParseToolData<'a, Transform<F>> for PredicateRefTool<P>
impl<'a, P: Fn(&char) -> bool, D, F: Fn(char) -> D> ParseToolData<'a, Transform<F>> for PredicateRefTool<P>
impl<P: Copy> Copy for PredicateRefTool<P>
Auto Trait Implementations§
impl<P> Freeze for PredicateRefTool<P>where
P: Freeze,
impl<P> RefUnwindSafe for PredicateRefTool<P>where
P: RefUnwindSafe,
impl<P> Send for PredicateRefTool<P>where
P: Send,
impl<P> Sync for PredicateRefTool<P>where
P: Sync,
impl<P> Unpin for PredicateRefTool<P>where
P: Unpin,
impl<P> UnwindSafe for PredicateRefTool<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