Skip to content

Commit 0989adf

Browse files
authored
Rollup merge of rust-lang#50574 - s3bk:range_inclusive_into_inner, r=SimonSapin
add fn `into_inner(self) -> (Idx, Idx)` to RangeInclusive (rust-lang#49022) adds `into_inner(self) -> (Idx, Idx)` to RangeInclusive rust-lang#49022 (comment)
2 parents 1eb617c + 23aa483 commit 0989adf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/libcore/ops/range.rs

+15
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,21 @@ impl<Idx> RangeInclusive<Idx> {
411411
pub fn end(&self) -> &Idx {
412412
&self.end
413413
}
414+
415+
/// Destructures the RangeInclusive into (lower bound, upper (inclusive) bound).
416+
///
417+
/// # Examples
418+
///
419+
/// ```
420+
/// #![feature(inclusive_range_methods)]
421+
///
422+
/// assert_eq!((3..=5).into_inner(), (3, 5));
423+
/// ```
424+
#[unstable(feature = "inclusive_range_methods", issue = "49022")]
425+
#[inline]
426+
pub fn into_inner(self) -> (Idx, Idx) {
427+
(self.start, self.end)
428+
}
414429
}
415430

416431
#[stable(feature = "inclusive_range", since = "1.26.0")]

0 commit comments

Comments
 (0)