From cf2b1c1b3eded5d6d8f84e52bc9eccad051dd5bf Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 14 May 2018 23:31:20 +0100 Subject: Stabilise into_inner --- src/libcore/ops/range.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 28707f8aa05..2664e18a93c 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -404,6 +404,19 @@ impl RangeInclusive { pub fn end(&self) -> &Idx { &self.end } + + /// Destructures the RangeInclusive into (lower bound, upper (inclusive) bound). + /// + /// # Examples + /// + /// ``` + /// assert_eq!((3..=5).into_inner(), (3, 5)); + /// ``` + #[stable(feature = "inclusive_range_methods", since = "1.27.0")] + #[inline] + pub fn into_inner(self) -> (Idx, Idx) { + (self.start, self.end) + } } #[stable(feature = "inclusive_range", since = "1.26.0")] -- cgit 1.4.1-3-g733a5