[−][src]Struct grep_regex::RegexMatcher
An implementation of the Matcher
trait using Rust's standard regex
library.
Methods
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]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
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 Send for RegexMatcher
impl Sync for RegexMatcher
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,