pub struct RangeInclusive<Idx: Clone + PartialOrd> { /* private fields */ }
Expand description

A range bounded inclusively below and above (start..=end).

The RangeInclusive start..=end contains all values with x >= start and x <= end. It is empty unless start <= end.

See the crate-level docs for more information.

Implementations§

source§

impl<Idx: Clone + PartialOrd> RangeInclusive<Idx>

source

pub const fn new(start: Idx, end: Idx) -> Self

Creates a new inclusive range.

source

pub const fn start(&self) -> &Idx

Returns the lower bound of the range (inclusive).

source

pub const fn end(&self) -> &Idx

Returns the upper bound of the range (inclusive).

source

pub fn into_inner(self) -> (Idx, Idx)

Destructures the RangeInclusive into (lower bound, upper (inclusive) bound).

source

pub fn is_empty(&self) -> bool

Returns true if the range contains no items.

source

pub fn iter(&self) -> RangeInclusiveIterator<Idx>

Returns an iterator with the same start and end values as the range.

source

pub fn contains<U>(&self, item: &U) -> boolwhere Idx: PartialOrd<U>, U: ?Sized + PartialOrd<Idx>,

Returns true if item is contained in the range.

Trait Implementations§

source§

impl<Idx: Clone + Clone + PartialOrd> Clone for RangeInclusive<Idx>

source§

fn clone(&self) -> RangeInclusive<Idx>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Idx: Clone + PartialOrd + Debug> Debug for RangeInclusive<Idx>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Idx: Hash + Clone + PartialOrd> Hash for RangeInclusive<Idx>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a, Idx: Clone + PartialOrd + Step> IntoIterator for &'a RangeInclusive<Idx>

§

type Item = Idx

The type of the elements being iterated over.
§

type IntoIter = RangeInclusiveIterator<Idx>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> RangeInclusiveIterator<Idx>

Creates an iterator from a value. Read more
source§

impl<Idx: PartialEq + Clone + PartialOrd> PartialEq<RangeInclusive<Idx>> for RangeInclusive<Idx>

source§

fn eq(&self, other: &RangeInclusive<Idx>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Clone + PartialOrd> RangeBounds<T> for RangeInclusive<T>

source§

fn start_bound(&self) -> Bound<&T>

Start index bound. Read more
source§

fn end_bound(&self) -> Bound<&T>

End index bound. Read more
1.35.0 · source§

fn contains<U>(&self, item: &U) -> boolwhere T: PartialOrd<U>, U: PartialOrd<T> + ?Sized,

Returns true if item is contained in the range. Read more
source§

impl<Idx: Copy + Clone + PartialOrd> Copy for RangeInclusive<Idx>

source§

impl<Idx: Eq + Clone + PartialOrd> Eq for RangeInclusive<Idx>

source§

impl<Idx: Clone + PartialOrd> StructuralEq for RangeInclusive<Idx>

source§

impl<Idx: Clone + PartialOrd> StructuralPartialEq for RangeInclusive<Idx>

Auto Trait Implementations§

§

impl<Idx> RefUnwindSafe for RangeInclusive<Idx>where Idx: RefUnwindSafe,

§

impl<Idx> Send for RangeInclusive<Idx>where Idx: Send,

§

impl<Idx> Sync for RangeInclusive<Idx>where Idx: Sync,

§

impl<Idx> Unpin for RangeInclusive<Idx>where Idx: Unpin,

§

impl<Idx> UnwindSafe for RangeInclusive<Idx>where Idx: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.