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
This commit is contained in:
Alex Crichton 2018-05-10 11:35:31 -05:00 committed by GitHub
commit 445e53e434
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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")]