Trait RangeBounds
pub trait RangeBounds<T: ?Sized>
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
fn start_bound(&self) -> Bound<&T>Start index bound.
Returns the start value as a
Bound.Examples
use *; use RangeBounds; assert_eq!; assert_eq!;fn end_bound(&self) -> Bound<&T>End index bound.
Returns the end value as a
Bound.Examples
use *; use RangeBounds; assert_eq!; assert_eq!;
Provided Methods
fn contains<U>(&self, item: &U) -> bool where T: ~const PartialOrd<U>, U: ?Sized + ~const PartialOrd<T>,Returns
trueifitemis contained in the range.Examples
assert!; assert!; assert!; assert!; assert!; assert!;fn is_empty(&self) -> bool where T: ~const PartialOrd,Returns
trueif the range contains no items. One-sided ranges (RangeFrom, etc) always returnfalse.Examples
use RangeBounds; assert!; assert!; assert!; assert!; assert!;The range is empty if either side is incomparable:
use RangeBounds; assert!; assert!; assert!;But never empty if either side is unbounded:
use RangeBounds; assert!; assert!; assert!;(Excluded(a), Excluded(b))is only empty ifa >= b:use *; use RangeBounds; assert!; assert!; assert!; assert!; assert!;
Implementors
impl<'a, T: ?Sized + 'a> RangeBounds<T> for (Bound<&'a T>, Bound<&'a T>)impl<T> RangeBounds<T> for (Bound<T>, Bound<T>)impl<T> RangeBounds<T> for Range<&T>impl<T> RangeBounds<T> for Range<&T>impl<T> RangeBounds<T> for Range<T>impl<T> RangeBounds<T> for Range<T>impl<T> RangeBounds<T> for RangeFrom<&T>impl<T> RangeBounds<T> for RangeFrom<&T>impl<T> RangeBounds<T> for RangeFrom<T>impl<T> RangeBounds<T> for RangeFrom<T>impl<T> RangeBounds<T> for RangeInclusive<&T>impl<T> RangeBounds<T> for RangeInclusive<&T>impl<T> RangeBounds<T> for RangeInclusive<T>impl<T> RangeBounds<T> for RangeInclusive<T>impl<T> RangeBounds<T> for RangeTo<&T>impl<T> RangeBounds<T> for RangeTo<T>impl<T> RangeBounds<T> for RangeToInclusive<&T>impl<T> RangeBounds<T> for RangeToInclusive<&T>impl<T> RangeBounds<T> for RangeToInclusive<T>impl<T> RangeBounds<T> for RangeToInclusive<T>impl<T: ?Sized> RangeBounds<T> for RangeFull