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§
Source§impl Ord for Match
impl Ord for Match
Source§impl PartialOrd for Match
impl PartialOrd for Match
impl Eq 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 UnwindSafe for Match
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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.