pub struct PredicateTool<P> { /* private fields */ }Expand description
Tool that matches characters which satisfies the provided predicate.
See also PredicateRefTool.
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> PredicateTool<P>
impl<P: Fn(char) -> bool> PredicateTool<P>
Sourcepub const fn new(predicate: P) -> Self
pub const fn new(predicate: P) -> Self
Create a new PredicateTool 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) -> RepeatToolMin<Self, TrueParser>
pub const fn new_one_or_more(predicate: P) -> RepeatToolMin<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 PredicateTool<P>
impl<P: Clone> Clone for PredicateTool<P>
Source§fn clone(&self) -> PredicateTool<P>
fn clone(&self) -> PredicateTool<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 PredicateTool<P>
impl<P: Debug> Debug for PredicateTool<P>
impl<P: Copy> Copy for PredicateTool<P>
Auto Trait Implementations§
impl<P> Freeze for PredicateTool<P>where
P: Freeze,
impl<P> RefUnwindSafe for PredicateTool<P>where
P: RefUnwindSafe,
impl<P> Send for PredicateTool<P>where
P: Send,
impl<P> Sync for PredicateTool<P>where
P: Sync,
impl<P> Unpin for PredicateTool<P>where
P: Unpin,
impl<P> UnwindSafe for PredicateTool<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