diff options
| author | varkor <github@varkor.com> | 2018-05-14 23:31:20 +0100 |
|---|---|---|
| committer | Pietro Albini <pietro@pietroalbini.org> | 2018-05-21 15:56:10 +0200 |
| commit | cf2b1c1b3eded5d6d8f84e52bc9eccad051dd5bf (patch) | |
| tree | 5879c8221620ed04813745d1cdb7385239a13ba2 /src | |
| parent | 3070f394629ae8c6463269247ea0cb223d5328f1 (diff) | |
| download | rust-cf2b1c1b3eded5d6d8f84e52bc9eccad051dd5bf.tar.gz rust-cf2b1c1b3eded5d6d8f84e52bc9eccad051dd5bf.zip | |
Stabilise into_inner
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/ops/range.rs | 13 |
1 files changed, 13 insertions, 0 deletions
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<Idx> RangeInclusive<Idx> { 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")] |
