diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2018-05-10 11:35:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-10 11:35:31 -0500 |
| commit | 445e53e4344fa80c6ef3314df702c401425af5ef (patch) | |
| tree | 3dd4f92034d3e5bf70fbcbe56d9959f1b7870f4f /src | |
| parent | be6fab8ca8b89da2aea447d6e597074810e3f351 (diff) | |
| parent | 23aa4831026b96869d0e0c283d39ba5fb35e786f (diff) | |
| download | rust-445e53e4344fa80c6ef3314df702c401425af5ef.tar.gz rust-445e53e4344fa80c6ef3314df702c401425af5ef.zip | |
Rollup merge of #50574 - s3bk:range_inclusive_into_inner, r=SimonSapin
add fn `into_inner(self) -> (Idx, Idx)` to RangeInclusive (#49022) adds `into_inner(self) -> (Idx, Idx)` to RangeInclusive https://github.com/rust-lang/rust/issues/49022#issuecomment-387645176
Diffstat (limited to 'src')
| -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")] |
