pub struct Match { /* private fields */ }Expand description
The match location of a Regex against a given input.
The sub-match indices are relative to the input used to run the original match.
Implementations§
Source§impl Match
impl Match
Sourcepub fn match_text<'a, H>(&self, haystack: &'a H) -> Cow<'a, str>where
H: Haystack,
pub fn match_text<'a, H>(&self, haystack: &'a H) -> Cow<'a, str>where
H: Haystack,
Extract this match from the given haystack
Sourcepub fn submatch_text<'a, H>(
&self,
n: usize,
haystack: &'a H,
) -> Option<Cow<'a, str>>where
H: Haystack,
pub fn submatch_text<'a, H>(
&self,
n: usize,
haystack: &'a H,
) -> Option<Cow<'a, str>>where
H: Haystack,
Extract the given submatch by index if it exists
Sourcepub fn submatch_text_by_name<'a, H>(
&self,
name: &str,
haystack: &'a H,
) -> Option<Cow<'a, str>>where
H: Haystack,
pub fn submatch_text_by_name<'a, H>(
&self,
name: &str,
haystack: &'a H,
) -> Option<Cow<'a, str>>where
H: Haystack,
Extract the given submatch by name if it exists
Sourcepub fn named_matches(&self) -> Vec<&str>
pub fn named_matches(&self) -> Vec<&str>
The names of each submatch
pub fn iter_locs(&self) -> impl Iterator<Item = Option<(usize, usize)>>
Trait Implementations§
impl Eq for Match
Source§impl Ord for Match
impl Ord for Match
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Match
impl PartialOrd for Match
impl StructuralPartialEq for Match
Auto Trait Implementations§
impl Freeze for Match
impl RefUnwindSafe for Match
impl Send for Match
impl Sync for Match
impl Unpin for Match
impl UnsafeUnpin for Match
impl UnwindSafe for Match
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.