Enum Range

Source
pub enum Range<Idx> {
    Continuous(ContinuousRange<Idx>),
    Composite(Vec<ContinuousRange<Idx>>),
}

Variants§

§

Continuous(ContinuousRange<Idx>)

§

Composite(Vec<ContinuousRange<Idx>>)

Implementations§

Source§

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

Source

pub fn empty() -> Self

A range containing no value

[]

Source

pub fn single(value: Idx) -> Range<Idx>

A range containing a single value

value

Source

pub fn continuous(start: Idx, end: Idx) -> Self
where Idx: PartialOrd,

A range between start (inclusive) and end (inclusive)

[start..end]

Source

pub fn continuous_exclusive(start: Idx, end: Idx) -> Self
where Idx: PartialOrd,

A range between start (exclusive) and end (exclusive)

(start..end)

Source

pub fn continuous_start_exclusive(start: Idx, end: Idx) -> Range<Idx>
where Idx: PartialOrd,

A range between start (exclusive) and end (inclusive)

(start..end]

Source

pub fn continuous_end_exclusive(start: Idx, end: Idx) -> Range<Idx>
where Idx: PartialOrd,

A range between start (inclusive) and end (exclusive)

[start..end)

Source

pub fn from(start: Idx) -> Self

A range starting from start (inclusive)

[start..)

Source

pub fn from_exclusive(start: Idx) -> Self

A range starting from start (exclusive)

(start..)

Source

pub fn to(end: Idx) -> Self

A range ending with end (inclusive)

(..end]

Source

pub fn to_exclusive(end: Idx) -> Self

A range ending with end (exclusive)

(..end)

Source

pub fn full() -> Range<Idx>

A range containing all values

Source

pub fn composite(items: impl IntoIterator<Item = Range<Idx>>) -> Range<Idx>
where Idx: PartialOrd,

Source

pub fn range_bounds(&self) -> Option<(Bound<&Idx>, Bound<&Idx>)>

Source

pub fn contains(&self, value: impl Borrow<Idx>) -> bool
where Idx: PartialOrd,

Source

pub fn union(&self, other: &Range<Idx>) -> Range<Idx>
where Idx: PartialOrd,

Source

pub fn intersection(self, _other: &Range<Idx>) -> Range<Idx>

Source

pub fn difference(self, _other: &Range<Idx>) -> Range<Idx>

Source

pub fn overlaps(self, _other: &Range<Idx>) -> bool

Source

pub fn compare_bounds(&self, _other: &Range<Idx>) -> RangesRelation

Compare the bounds of two ranges

Source

pub fn simplify_mut(&mut self)
where Idx: PartialOrd,

Source

pub fn simplify(&self) -> Self
where Idx: PartialOrd + Clone,

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_full(&self) -> bool
where Idx: PartialOrd + Clone,

Trait Implementations§

Source§

impl<Idx: PartialOrd + Clone> Add<&Range<Idx>> for Range<Idx>

Source§

type Output = Range<Idx>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Range<Idx>) -> Range<Idx>

Performs the + operation. Read more
Source§

impl<Idx: Clone> Clone for Range<Idx>

Source§

fn clone(&self) -> Range<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: Debug> Debug for Range<Idx>

Source§

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

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

impl<Idx> Default for Range<Idx>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Idx> From<ContinuousRange<Idx>> for Range<Idx>

Source§

fn from(r: ContinuousRange<Idx>) -> Self

Converts to this type from the input type.
Source§

impl<Idx: PartialOrd + Clone> From<Range<Idx>> for Range<Idx>

Source§

fn from(r: Range<Idx>) -> Self

Converts to this type from the input type.
Source§

impl<Idx: PartialOrd + Clone> From<RangeFrom<Idx>> for Range<Idx>

Source§

fn from(r: RangeFrom<Idx>) -> Self

Converts to this type from the input type.
Source§

impl<Idx: PartialOrd + Clone> From<RangeFull> for Range<Idx>

Source§

fn from(_: RangeFull) -> Self

Converts to this type from the input type.
Source§

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

Source§

fn from(r: RangeInclusive<Idx>) -> Self

Converts to this type from the input type.
Source§

impl<Idx: PartialOrd + Clone> From<RangeTo<Idx>> for Range<Idx>

Source§

fn from(r: RangeTo<Idx>) -> Self

Converts to this type from the input type.
Source§

impl<Idx: PartialOrd + Clone> From<RangeToInclusive<Idx>> for Range<Idx>

Source§

fn from(r: RangeToInclusive<Idx>) -> Self

Converts to this type from the input type.
Source§

impl<Idx: Hash> Hash for Range<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<Idx: PartialEq> PartialEq for Range<Idx>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Idx: PartialOrd + Clone> Sub for Range<Idx>

Source§

type Output = Range<Idx>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Range<Idx>) -> Range<Idx>

Performs the - operation. Read more
Source§

impl<Idx> StructuralPartialEq for Range<Idx>

Auto Trait Implementations§

§

impl<Idx> Freeze for Range<Idx>
where Idx: Freeze,

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.