Skip to content

Commit cf2b1c1

Browse files
varkorpietroalbini
authored andcommitted
Stabilise into_inner
1 parent 3070f39 commit cf2b1c1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/libcore/ops/range.rs

+13
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,19 @@ impl<Idx> RangeInclusive<Idx> {
404404
pub fn end(&self) -> &Idx {
405405
&self.end
406406
}
407+
408+
/// Destructures the RangeInclusive into (lower bound, upper (inclusive) bound).
409+
///
410+
/// # Examples
411+
///
412+
/// ```
413+
/// assert_eq!((3..=5).into_inner(), (3, 5));
414+
/// ```
415+
#[stable(feature = "inclusive_range_methods", since = "1.27.0")]
416+
#[inline]
417+
pub fn into_inner(self) -> (Idx, Idx) {
418+
(self.start, self.end)
419+
}
407420
}
408421

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

0 commit comments

Comments
 (0)