Skip to content

Commit

Permalink
Rollup merge of rust-lang#50574 - s3bk:range_inclusive_into_inner, r=…
Browse files Browse the repository at this point in the history
…SimonSapin

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

adds `into_inner(self) -> (Idx, Idx)` to RangeInclusive
rust-lang#49022 (comment)
  • Loading branch information
alexcrichton committed May 10, 2018
2 parents be6fab8 + 23aa483 commit 445e53e
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 445e53e

Please sign in to comment.