Skip to content

Commit 23aa483

Browse files
author
Sebastian Köln
committed
add fn into_inner(self) -> (Idx, Idx) to RangeInclusive (rust-lang#49022)
1 parent 8ff4b42 commit 23aa483

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/libcore/ops/range.rs

+15
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,21 @@ impl<Idx> RangeInclusive<Idx> {
411411
pub fn end(&self) -> &Idx {
412412
&self.end
413413
}
414+
415+
/// Destructures the RangeInclusive into (lower bound, upper (inclusive) bound).
416+
///
417+
/// # Examples
418+
///
419+
/// ```
420+
/// #![feature(inclusive_range_methods)]
421+
///
422+
/// assert_eq!((3..=5).into_inner(), (3, 5));
423+
/// ```
424+
#[unstable(feature = "inclusive_range_methods", issue = "49022")]
425+
#[inline]
426+
pub fn into_inner(self) -> (Idx, Idx) {
427+
(self.start, self.end)
428+
}
414429
}
415430

416431
#[stable(feature = "inclusive_range", since = "1.26.0")]

0 commit comments

Comments
 (0)