pub enum Matcher {
Regex(Regex),
Literal(Box<Finder<'static>>),
}Expand description
Matcher abstraction: either a compiled regex or a memchr literal finder.
Variants§
Implementations§
Source§impl Matcher
impl Matcher
Sourcepub fn find(&self, text: &str) -> Option<(usize, usize)>
pub fn find(&self, text: &str) -> Option<(usize, usize)>
Find the first match in text, returning (start, end) byte offsets.
Sourcepub fn find_iter_positions(&self, text: &str) -> Vec<(usize, usize)>
pub fn find_iter_positions(&self, text: &str) -> Vec<(usize, usize)>
Iterate all matches in text (for multiline mode).
Sourcepub fn count_matches(&self, text: &str, stop_after_first: bool) -> usize
pub fn count_matches(&self, text: &str, stop_after_first: bool) -> usize
Count matches in text, optionally stopping after the first match.
Auto Trait Implementations§
impl Freeze for Matcher
impl RefUnwindSafe for Matcher
impl Send for Matcher
impl Sync for Matcher
impl Unpin for Matcher
impl UnsafeUnpin for Matcher
impl UnwindSafe for Matcher
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more