about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSebastian Köln <sebk@rynx.org>2018-05-09 18:03:13 +0200
committerSebastian Köln <sebk@rynx.org>2018-05-09 18:03:13 +0200
commit23aa4831026b96869d0e0c283d39ba5fb35e786f (patch)
tree0c9a79f68109a1974fa7adf31ef0ffd2708a8a44
parent8ff4b42064b374bb62043f7729f84b6d979c7667 (diff)
downloadrust-23aa4831026b96869d0e0c283d39ba5fb35e786f.tar.gz
rust-23aa4831026b96869d0e0c283d39ba5fb35e786f.zip
add fn `into_inner(self) -> (Idx, Idx)` to RangeInclusive (#49022)
-rw-r--r--src/libcore/ops/range.rs15
1 files changed, 15 insertions, 0 deletions
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<Idx> RangeInclusive<Idx> {
     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")]