From 23aa4831026b96869d0e0c283d39ba5fb35e786f Mon Sep 17 00:00:00 2001 From: Sebastian Köln Date: Wed, 9 May 2018 18:03:13 +0200 Subject: add fn `into_inner(self) -> (Idx, Idx)` to RangeInclusive (#49022) --- src/libcore/ops/range.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index b01a769eda7..697e6a3efde 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -411,6 +411,21 @@ impl RangeInclusive { pub fn end(&self) -> &Idx { &self.end } + + /// Destructures the RangeInclusive into (lower bound, upper (inclusive) bound). + /// + /// # Examples + /// + /// ``` + /// #![feature(inclusive_range_methods)] + /// + /// assert_eq!((3..=5).into_inner(), (3, 5)); + /// ``` + #[unstable(feature = "inclusive_range_methods", issue = "49022")] + #[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