pub trait RangeBounds<T>where
T: ?Sized,{
// Required methods
fn start_bound(&self) -> Bound<&T>;
fn end_bound(&self) -> Bound<&T>;
// Provided method
fn contains<U>(&self, item: &U) -> bool
where T: PartialOrd<U>,
U: PartialOrd<T> + ?Sized { ... }
}🔬This is a nightly-only experimental API. (
new_range_api)Expand description
RangeBounds is implemented by Rust’s built-in range types, produced
by range syntax like .., a.., ..b, ..=c, d..e, or f..=g.
Required Methods§
sourcefn start_bound(&self) -> Bound<&T>
🔬This is a nightly-only experimental API. (new_range_api)
fn start_bound(&self) -> Bound<&T>
new_range_api)Start index bound.
Returns the start value as a Bound.
§Examples
use std::ops::Bound::*;
use std::ops::RangeBounds;
assert_eq!((..10).start_bound(), Unbounded);
assert_eq!((3..10).start_bound(), Included(&3));