Skip to content

Commit cc73598

Browse files
committed
fixup! api: Add as_match method
1 parent 7311bfc commit cc73598

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/regex/bytes.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,16 +1670,18 @@ impl<'h> Captures<'h> {
16701670
/// This returns the match for index `0`. That is it is equivalent to
16711671
/// `m.get(0).unwrap()`
16721672
///
1673+
/// # Example
1674+
///
16731675
/// ```
16741676
/// use regex::bytes::Regex;
16751677
///
16761678
/// let re = Regex::new(r"[a-z]+([0-9]+)").unwrap();
16771679
/// let caps = re.captures(b" abc123-def").unwrap();
16781680
///
1679-
/// assert_eq!(caps.as_match().as_bytes(), b"abc123");
1681+
/// assert_eq!(caps.get_match().as_bytes(), b"abc123");
16801682
/// ```
16811683
#[inline]
1682-
pub fn as_match(&self) -> Match {
1684+
pub fn get_match(&self) -> Match {
16831685
self.get(0).unwrap()
16841686
}
16851687

src/regex/string.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,17 +1680,19 @@ impl<'h> Captures<'h> {
16801680
/// This returns the match for index `0`. That is it is equivalent to
16811681
/// `m.get(0).unwrap()`
16821682
///
1683+
/// # Example
1684+
///
16831685
/// ```
16841686
/// use regex::Regex;
16851687
///
16861688
/// let re = Regex::new(r"[a-z]+([0-9]+)").unwrap();
16871689
/// let caps = re.captures(" abc123-def").unwrap();
16881690
///
1689-
/// assert_eq!(caps.as_match().as_str(), "abc123");
1691+
/// assert_eq!(caps.get_match().as_str(), "abc123");
16901692
///
16911693
/// ```
16921694
#[inline]
1693-
pub fn as_match(&self) -> Match {
1695+
pub fn get_match(&self) -> Match {
16941696
self.get(0).unwrap()
16951697
}
16961698

0 commit comments

Comments
 (0)