diff options
| author | Sebastian Köln <sebk@rynx.org> | 2018-05-09 18:03:13 +0200 |
|---|---|---|
| committer | Sebastian Köln <sebk@rynx.org> | 2018-05-09 18:03:13 +0200 |
| commit | 23aa4831026b96869d0e0c283d39ba5fb35e786f (patch) | |
| tree | 0c9a79f68109a1974fa7adf31ef0ffd2708a8a44 | |
| parent | 8ff4b42064b374bb62043f7729f84b6d979c7667 (diff) | |
| download | rust-23aa4831026b96869d0e0c283d39ba5fb35e786f.tar.gz rust-23aa4831026b96869d0e0c283d39ba5fb35e786f.zip | |
add fn `into_inner(self) -> (Idx, Idx)` to RangeInclusive (#49022)
| -rw-r--r-- | src/libcore/ops/range.rs | 15 |
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")] |
