Trait IntoBounds

Source
pub trait IntoBounds<T>: RangeBounds<T> {
    // Required method
    fn into_bounds(self) -> (Bound<T>, Bound<T>);
}
🔬This is a nightly-only experimental API. (range_into_bounds)
Expand description

Used to convert a range into start and end bounds, consuming the range by value.

IntoBounds is implemented by Rust’s built-in range types, produced by range syntax like .., a.., ..b, ..=c, d..e, or f..=g.

Required Methods§

Source

fn into_bounds(self) -> (Bound<T>, Bound<T>)

🔬This is a nightly-only experimental API. (range_into_bounds)

Convert this range into the start and end bounds. Returns (start_bound, end_bound).

§Examples
#![feature(range_into_bounds)]

use std::ops::Bound::*;
use std::ops::IntoBounds;

assert_eq!((0..5).into_bounds(), (Included(0), Excluded(5)));
assert_eq!((..=7).into_bounds(), (Unbounded, Included(7)));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> IntoBounds<T> for (Bound<T>, Bound<T>)

Source§

impl<T> IntoBounds<T> for core::range::Range<T>

Source§

impl<T> IntoBounds<T> for core::range::RangeFrom<T>

Source§

impl<T> IntoBounds<T> for core::range::RangeInclusive<T>

Source§

impl<T> IntoBounds<T> for no_std_compat::ops::Range<T>

Source§

impl<T> IntoBounds<T> for no_std_compat::ops::RangeFrom<T>

Source§

impl<T> IntoBounds<T> for RangeFull

Source§

impl<T> IntoBounds<T> for no_std_compat::ops::RangeInclusive<T>

Source§

impl<T> IntoBounds<T> for RangeTo<T>

Source§

impl<T> IntoBounds<T> for RangeToInclusive<T>