Skip to content

Commit

Permalink
regex: add as_match method to Captures trait
Browse files Browse the repository at this point in the history
  • Loading branch information
tmccombs authored Sep 19, 2024
1 parent 8bd5950 commit bf63fe8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/matcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,15 @@ pub trait Captures {
/// for the overall match.
fn get(&self, i: usize) -> Option<Match>;

/// Return the overall match for the capture.
///
/// This returns the match for index `0`. That is it is equivalent to
/// `get(0).unwrap()`
#[inline]
fn as_match(&self) -> Match {
self.get(0).unwrap()
}

/// Returns true if and only if these captures are empty. This occurs
/// when `len` is `0`.
///
Expand Down

0 comments on commit bf63fe8

Please sign in to comment.