mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 01:30:21 -07:00
regex: add as_match method to Captures trait
Ref https://github.com/rust-lang/regex/issues/1146 PR #2898
This commit is contained in:
parent
8bd5950296
commit
bf63fe8f25
@ -389,6 +389,15 @@ pub trait Captures {
|
|||||||
/// for the overall match.
|
/// for the overall match.
|
||||||
fn get(&self, i: usize) -> Option<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
|
/// Returns true if and only if these captures are empty. This occurs
|
||||||
/// when `len` is `0`.
|
/// when `len` is `0`.
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user