1
Fork 0

add fn into_inner(self) -> (Idx, Idx) to RangeInclusive (#49022)

This commit is contained in:
Sebastian Köln 2018-05-09 18:03:13 +02:00
parent 8ff4b42064
commit 23aa483102

View file

@ -411,6 +411,21 @@ impl<Idx> RangeInclusive<Idx> {
pub fn end(&self) -> &Idx { pub fn end(&self) -> &Idx {
&self.end &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")] #[stable(feature = "inclusive_range", since = "1.26.0")]