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
pub fn str_match_text(&self, s: &str) -> String
sourcepub fn str_loc_bytes(&self, s: &str) -> (usize, usize)
pub fn str_loc_bytes(&self, s: &str) -> (usize, usize)
The start and end of this match in terms of byte offsets
use loc for character offsets
sourcepub fn str_sub_loc_bytes(&self, n: usize, s: &str) -> Option<(usize, usize)>
pub fn str_sub_loc_bytes(&self, n: usize, s: &str) -> Option<(usize, usize)>
The start and end of the nth submatch in terms of byte offsets
pub fn named_matches(&self) -> Vec<&str>
sourcepub fn str_sub_loc_bytes_by_name(
&self,
name: &str,
s: &str,
) -> Option<(usize, usize)>
pub fn str_sub_loc_bytes_by_name( &self, name: &str, s: &str, ) -> Option<(usize, usize)>
The start and end of a named submatch in terms of byte offsets
pub fn str_sub_loc_text_ref_by_name<'a>( &self, name: &str, s: &'a str, ) -> Option<&'a str>
pub fn str_match_text_ref<'a>(&self, s: &'a str) -> &'a str
pub fn str_submatch_text(&self, n: usize, s: &str) -> Option<String>
sourcepub fn loc(&self) -> (usize, usize)
pub fn loc(&self) -> (usize, usize)
The start and end of this match in terms of character offsets
use str_loc_bytes for byte offsets
pub fn sub_loc_by_name(&self, name: &str) -> Option<(usize, usize)>
pub fn sub_loc(&self, n: usize) -> Option<(usize, usize)>
Trait Implementations§
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§
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)