[−][src]Struct grep_pcre2::RegexMatcher
An implementation of the Matcher
trait using PCRE2.
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.
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 = Error
The error type used by this matcher. Read more
fn find_at(&self, haystack: &[u8], at: usize) -> Result<Option<Match>, Error>
[src]
fn new_captures(&self) -> Result<RegexCaptures, Error>
[src]
fn capture_count(&self) -> usize
[src]
fn capture_index(&self, name: &str) -> Option<usize>
[src]
fn try_find_iter<F, E>(
&self,
haystack: &[u8],
matched: F
) -> Result<Result<(), E>, Error> where
F: FnMut(Match) -> Result<bool, E>,
[src]
&self,
haystack: &[u8],
matched: F
) -> Result<Result<(), E>, Error> where
F: FnMut(Match) -> Result<bool, E>,
fn captures_at(
&self,
haystack: &[u8],
at: usize,
caps: &mut RegexCaptures
) -> Result<bool, Error>
[src]
&self,
haystack: &[u8],
at: usize,
caps: &mut RegexCaptures
) -> Result<bool, Error>
default fn find(&self, haystack: &[u8]) -> Result<Option<Match>, Self::Error>
[src]
Returns the start and end byte range of the first match in haystack
. If no match exists, then None
is returned. Read more
default fn find_iter<F>(
&self,
haystack: &[u8],
matched: F
) -> Result<(), Self::Error> where
F: FnMut(Match) -> bool,
[src]
&self,
haystack: &[u8],
matched: F
) -> Result<(), Self::Error> where
F: FnMut(Match) -> bool,
Executes the given function over successive non-overlapping matches in haystack
. If no match exists, then the given function is never called. If the function returns false
, then iteration stops. Read more
default fn captures(
&self,
haystack: &[u8],
caps: &mut Self::Captures
) -> Result<bool, Self::Error>
[src]
&self,
haystack: &[u8],
caps: &mut Self::Captures
) -> Result<bool, Self::Error>
Populates the first set of capture group matches from haystack
into caps
. If no match exists, then false
is returned. Read more
default fn captures_iter<F>(
&self,
haystack: &[u8],
caps: &mut Self::Captures,
matched: F
) -> Result<(), Self::Error> where
F: FnMut(&Self::Captures) -> bool,
[src]
&self,
haystack: &[u8],
caps: &mut Self::Captures,
matched: F
) -> Result<(), Self::Error> where
F: FnMut(&Self::Captures) -> bool,
Executes the given function over successive non-overlapping matches in haystack
with capture groups extracted from each match. If no match exists, then the given function is never called. If the function returns false
, then iteration stops. Read more
default fn try_captures_iter<F, E>(
&self,
haystack: &[u8],
caps: &mut Self::Captures,
matched: F
) -> Result<Result<(), E>, Self::Error> where
F: FnMut(&Self::Captures) -> Result<bool, E>,
[src]
&self,
haystack: &[u8],
caps: &mut Self::Captures,
matched: F
) -> Result<Result<(), E>, Self::Error> where
F: FnMut(&Self::Captures) -> Result<bool, E>,
Executes the given function over successive non-overlapping matches in haystack
with capture groups extracted from each match. If no match exists, then the given function is never called. If the function returns false
, then iteration stops. Similarly, if the function returns an error then iteration stops and the error is yielded. If an error occurs while executing the search, then it is converted to E
. Read more
default fn replace<F>(
&self,
haystack: &[u8],
dst: &mut Vec<u8>,
append: F
) -> Result<(), Self::Error> where
F: FnMut(Match, &mut Vec<u8>) -> bool,
[src]
&self,
haystack: &[u8],
dst: &mut Vec<u8>,
append: F
) -> Result<(), Self::Error> where
F: FnMut(Match, &mut Vec<u8>) -> bool,
Replaces every match in the given haystack with the result of calling append
. append
is given the start and end of a match, along with a handle to the dst
buffer provided. Read more
default fn replace_with_captures<F>(
&self,
haystack: &[u8],
caps: &mut Self::Captures,
dst: &mut Vec<u8>,
append: F
) -> Result<(), Self::Error> where
F: FnMut(&Self::Captures, &mut Vec<u8>) -> bool,
[src]
&self,
haystack: &[u8],
caps: &mut Self::Captures,
dst: &mut Vec<u8>,
append: F
) -> Result<(), Self::Error> where
F: FnMut(&Self::Captures, &mut Vec<u8>) -> bool,
Replaces every match in the given haystack with the result of calling append
with the matching capture groups. Read more
default fn is_match(&self, haystack: &[u8]) -> Result<bool, Self::Error>
[src]
Returns true if and only if the matcher matches the given haystack. Read more
default fn is_match_at(
&self,
haystack: &[u8],
at: usize
) -> Result<bool, Self::Error>
[src]
&self,
haystack: &[u8],
at: usize
) -> Result<bool, Self::Error>
Returns true if and only if the matcher matches the given haystack starting at the given position. Read more
default fn shortest_match(
&self,
haystack: &[u8]
) -> Result<Option<usize>, Self::Error>
[src]
&self,
haystack: &[u8]
) -> Result<Option<usize>, Self::Error>
Returns an end location of the first match in haystack
. If no match exists, then None
is returned. Read more
default fn shortest_match_at(
&self,
haystack: &[u8],
at: usize
) -> Result<Option<usize>, Self::Error>
[src]
&self,
haystack: &[u8],
at: usize
) -> Result<Option<usize>, Self::Error>
Returns an end location of the first match in haystack
starting at the given position. If no match exists, then None
is returned. Read more
default fn non_matching_bytes(&self) -> Option<&ByteSet>
[src]
If available, return a set of bytes that will never appear in a match produced by an implementation. Read more
default fn line_terminator(&self) -> Option<LineTerminator>
[src]
If this matcher was compiled as a line oriented matcher, then this method returns the line terminator if and only if the line terminator never appears in any match produced by this matcher. If this wasn't compiled as a line oriented matcher, or if the aforementioned guarantee cannot be made, then this must return None
, which is the default. It is never wrong to return None
, but returning a line terminator when it can appear in a match results in unspecified behavior. Read more
default fn find_candidate_line(
&self,
haystack: &[u8]
) -> Result<Option<LineMatchKind>, Self::Error>
[src]
&self,
haystack: &[u8]
) -> Result<Option<LineMatchKind>, Self::Error>
Return one of the following: a confirmed line match, a candidate line match (which may be a false positive) or no match at all (which must not be a false negative). When reporting a confirmed or candidate match, the position returned can be any position in the line. Read more
Auto Trait Implementations
impl Send for RegexMatcher
impl Sync for RegexMatcher
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?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>,