Trait RangeBounds
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: &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: &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: &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: &Self) -> bool where T: ~const PartialOrdReturns
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<T> RangeBounds for Range<&T>impl<T> RangeBounds for RangeInclusive<&T>impl<T> RangeBounds for RangeFrom<&T>impl<T> RangeBounds for RangeToInclusive<T>impl<T> RangeBounds for RangeTo<T>impl<T> RangeBounds for RangeInclusive<T>impl<T> RangeBounds for (Bound<T>, Bound<T>)impl<T> RangeBounds for RangeToInclusive<T>impl<T> RangeBounds for RangeInclusive<&T>impl<T> RangeBounds for Range<T>impl<T: ?Sized> RangeBounds for RangeFullimpl<'a, T: ?Sized + 'a> RangeBounds for (Bound<&'a T>, Bound<&'a T>)impl<T> RangeBounds for RangeTo<&T>impl<T> RangeBounds for RangeFrom<T>impl<T> RangeBounds for RangeInclusive<T>impl<T> RangeBounds for RangeFrom<T>impl<T> RangeBounds for Range<T>impl<T> RangeBounds for RangeToInclusive<&T>impl<T> RangeBounds for Range<&T>impl<T> RangeBounds for RangeFrom<&T>