Enum ranges::Arrangement[][src]

pub enum Arrangement {
    Disjoint {
        self_less: bool,
    },
    Touching {
        self_less: bool,
    },
    Overlapping {
        self_less: bool,
        overlap_is_singleton: bool,
    },
    Containing {
        self_shorter: bool,
    },
    Starting {
        self_shorter: bool,
        shorter_is_singleton: bool,
    },
    Ending {
        self_shorter: bool,
        shorter_is_singleton: bool,
    },
    Equal,
    Empty {
        self_empty: Option<bool>,
    },
}
Expand description

This enum represents all possible arrangements of two GenericRanges.

Note

The following information is additionally contained if applicable:

  • which of the two ranges was self and other
  • if the overlap is a singleton
  • if start or other is a singleton
  • which of self and other is shorter

This information is the result of the comparison of the starts and ends of both ranges and is obtained “for free” and should thus be used preferably to other methods like GenericRange::is_singleton().

Variants

Disjoint

The two ranges have no overlap.

Diagram

first : |----------|
second:               |----------|
Show fields

Fields of Disjoint

self_less: bool

When GenericRange::arrangement(&self, &other) was invoked, either self or other was less.

Touching

The two ranges have no overlap but the end of the first touches the start of the second.

Diagram

first : |----------|
second:            |----------|
Show fields

Fields of Touching

self_less: bool

When GenericRange::arrangement(&self, &other) was invoked, either self or other was less.

Overlapping

The two ranges have an overlap of one or more elements.

Diagram

first          : |----------|
second         :         |----------|
first disjoint : |-------|
second disjoint:            |-------|
overlap        :         |--|
Show fields

Fields of Overlapping

self_less: bool

When GenericRange::arrangement(&self, &other) was invoked, either self or other was less.

overlap_is_singleton: bool

Indicates whether or not the overlap is by a single element, allowing optimization.

Containing

One range is contained in the other.

Diagram

first          : |--------------------|
second         :      |----------|
first disjoint : |----|
second disjoint:                 |----|
overlap        :      |----------|
Show fields

Fields of Containing

self_shorter: bool

When GenericRange::arrangement(&self, &other) was invoked, either self or other was shorter.

Starting

Both ranges have the same start but varying endings.

Diagram

first   : |-----|
second  : |----------|
overlap : |-----|
disjoint:       |----|
Show fields

Fields of Starting

self_shorter: bool

Indicates whether self or other in GenericRange::arrangement(&self, &other) was shorter.

shorter_is_singleton: bool

Depending on which of self or other is shorter, this boolean indicates that it is a singleton.

Ending

Both ranges have the same end but varying starts.

Diagram

first   : |----------|
second  :       |----|
disjoint: |-----|
overlap :       |----|
Show fields

Fields of Ending

self_shorter: bool

Indicates whether self or other in GenericRange::arrangement(&self, &other) was shorter.

shorter_is_singleton: bool

Depending on which of self or other is shorter, this boolean indicates that it is a singleton.

Equal

The starts and ends of both ranges are equal.

Diagram

first : |----------|
second: |----------|
equal : |----------|
Empty

One or both ranges are empty and can therefore not be compared.

Diagram

first :
second:    |----|
Show fields

Fields of Empty

self_empty: Option<bool>

Indicates which of the two inputs of GenericRange::arrangement(&self, &other) were empty. Returns None if both were empty.

Trait Implementations

impl Clone for Arrangement[src]

fn clone(&self) -> Arrangement[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Arrangement[src]

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

Formats the value using the given formatter. Read more

impl PartialEq<Arrangement> for Arrangement[src]

fn eq(&self, other: &Arrangement) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Arrangement) -> bool[src]

This method tests for !=.

impl Copy for Arrangement[src]

impl Eq for Arrangement[src]

impl StructuralEq for Arrangement[src]

impl StructuralPartialEq for Arrangement[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.