Skip to content

Commit

Permalink
add fn into_inner(self) -> (Idx, Idx) to RangeInclusive (#49022)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Köln committed May 9, 2018
1 parent 8ff4b42 commit 23aa483
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/libcore/ops/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit 23aa483

Please sign in to comment.