[−][src]Struct grep_regex::RegexMatcher
An implementation of the Matcher
trait using Rust's standard regex
library.
Implementations
impl RegexMatcher
[src]
pub fn new(pattern: &str) -> Result<RegexMatcher, Error>
[src]
Create a new matcher from the given pattern using the default configuration.
pub fn new_line_matcher(pattern: &str) -> Result<RegexMatcher, Error>
[src]
Create a new matcher from the given pattern using the default
configuration, but matches lines terminated by \n
.
This is meant to be a convenience constructor for using a
RegexMatcherBuilder
and setting its
line_terminator
to \n
. The purpose of using this constructor is to permit special
optimizations that help speed up line oriented search. These types of
optimizations are only appropriate when matches span no more than one
line. For this reason, this constructor will return an error if the
given pattern contains a literal \n
. Other uses of \n
(such as in
\s
) are removed transparently.
Trait Implementations
impl Clone for RegexMatcher
[src]
fn clone(&self) -> RegexMatcher
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for RegexMatcher
[src]
impl Matcher for RegexMatcher
[src]
type Captures = RegexCaptures
The concrete type of capturing groups used for this matcher. Read more
type Error = NoError
The error type used by this matcher. Read more
fn find_at(&self, haystack: &[u8], at: usize) -> Result<Option<Match>, NoError>
[src]
fn new_captures(&self) -> Result<RegexCaptures, NoError>
[src]
fn capture_count(&self) -> usize
[src]
fn capture_index(&self, name: &str) -> Option<usize>
[src]
fn find(&self, haystack: &[u8]) -> Result<Option<Match>, NoError>
[src]
fn find_iter<F>(&self, haystack: &[u8], matched: F) -> Result<(), NoError> where
F: FnMut(Match) -> bool,
[src]
F: FnMut(Match) -> bool,
fn try_find_iter<F, E>(
&self,
haystack: &[u8],
matched: F
) -> Result<Result<(), E>, NoError> where
F: FnMut(Match) -> Result<bool, E>,
[src]
&self,
haystack: &[u8],
matched: F
) -> Result<Result<(), E>, NoError> where
F: FnMut(Match) -> Result<bool, E>,
fn captures(
&self,
haystack: &[u8],
caps: &mut RegexCaptures
) -> Result<bool, NoError>
[src]
&self,
haystack: &[u8],
caps: &mut RegexCaptures
) -> Result<bool, NoError>
fn captures_iter<F>(
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
matched: F
) -> Result<(), NoError> where
F: FnMut(&RegexCaptures) -> bool,
[src]
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
matched: F
) -> Result<(), NoError> where
F: FnMut(&RegexCaptures) -> bool,
fn try_captures_iter<F, E>(
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
matched: F
) -> Result<Result<(), E>, NoError> where
F: FnMut(&RegexCaptures) -> Result<bool, E>,
[src]
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
matched: F
) -> Result<Result<(), E>, NoError> where
F: FnMut(&RegexCaptures) -> Result<bool, E>,
fn captures_at(
&self,
haystack: &[u8],
at: usize,
caps: &mut RegexCaptures
) -> Result<bool, NoError>
[src]
&self,
haystack: &[u8],
at: usize,
caps: &mut RegexCaptures
) -> Result<bool, NoError>
fn replace<F>(
&self,
haystack: &[u8],
dst: &mut Vec<u8>,
append: F
) -> Result<(), NoError> where
F: FnMut(Match, &mut Vec<u8>) -> bool,
[src]
&self,
haystack: &[u8],
dst: &mut Vec<u8>,
append: F
) -> Result<(), NoError> where
F: FnMut(Match, &mut Vec<u8>) -> bool,
fn replace_with_captures<F>(
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
dst: &mut Vec<u8>,
append: F
) -> Result<(), NoError> where
F: FnMut(&Self::Captures, &mut Vec<u8>) -> bool,
[src]
&self,
haystack: &[u8],
caps: &mut RegexCaptures,
dst: &mut Vec<u8>,
append: F
) -> Result<(), NoError> where
F: FnMut(&Self::Captures, &mut Vec<u8>) -> bool,
fn is_match(&self, haystack: &[u8]) -> Result<bool, NoError>
[src]
fn is_match_at(&self, haystack: &[u8], at: usize) -> Result<bool, NoError>
[src]
fn shortest_match(&self, haystack: &[u8]) -> Result<Option<usize>, NoError>
[src]
fn shortest_match_at(
&self,
haystack: &[u8],
at: usize
) -> Result<Option<usize>, NoError>
[src]
&self,
haystack: &[u8],
at: usize
) -> Result<Option<usize>, NoError>
fn non_matching_bytes(&self) -> Option<&ByteSet>
[src]
fn line_terminator(&self) -> Option<LineTerminator>
[src]
fn find_candidate_line(
&self,
haystack: &[u8]
) -> Result<Option<LineMatchKind>, NoError>
[src]
&self,
haystack: &[u8]
) -> Result<Option<LineMatchKind>, NoError>
Auto Trait Implementations
impl !RefUnwindSafe for RegexMatcher
impl Send for RegexMatcher
impl Sync for RegexMatcher
impl Unpin for RegexMatcher
impl !UnwindSafe for RegexMatcher
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,