Endpoint

Enum Endpoint 

Source
pub enum Endpoint<const SIDE: bool, T> {
    Included(T),
    Excluded(T),
    Infinite,
}
Expand description

The bound of an interval.

Variants§

§

Included(T)

The point is included in the interval.

§

Excluded(T)

The point is excluded from the interval.

§

Infinite

The interval is unbounded in this direction.

Implementations§

Source§

impl<const SIDE: bool, T> Endpoint<SIDE, T>

Source

pub fn into_bound(self) -> Bound<T>

Convert Endpoint into a Bound.

Source

pub fn into_exclusive_bound(self) -> Bound<T>

Convert Endpoint into an open Bound.

Source§

impl<const SIDE: bool, T> Endpoint<SIDE, T>

Source

pub const fn as_ref(&self) -> Endpoint<SIDE, &T>

Get an Endpoint with referenced point value.

Source

pub fn map<F, U>(self, f: F) -> Endpoint<SIDE, U>
where F: FnOnce(T) -> U,

Convert the underlying value of the endpoint preserving the inclusion/exclusion state.

Source

pub const fn is_finite(&self) -> bool

Whether the endpoint is finite.

Source

pub const fn bound_val(&self) -> Option<&T>

Get the underlying point of the endpoint, if finite.

Trait Implementations§

Source§

impl<const SIDE: bool, T, U, Z> Add<Endpoint<SIDE, U>> for Endpoint<SIDE, T>
where T: Add<U, Output = Z>,

Source§

type Output = Endpoint<SIDE, Z>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Endpoint<SIDE, U>) -> Self::Output

Performs the + operation. Read more
Source§

impl<const SIDE: bool, T: Clone> Clone for Endpoint<SIDE, T>

Source§

fn clone(&self) -> Endpoint<SIDE, T>

Returns a duplicate 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<const SIDE: bool, T: Debug> Debug for Endpoint<SIDE, T>

Source§

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

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

impl<const SIDE: bool, T> Display for Endpoint<SIDE, T>
where T: Display,

Source§

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

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

impl<const SIDE: bool, T> From<Bound<T>> for Endpoint<SIDE, T>

Source§

fn from(value: Bound<T>) -> Self

Converts to this type from the input type.
Source§

impl<const SIDE: bool, T> From<Endpoint<SIDE, T>> for Bound<T>

Source§

fn from(value: Endpoint<SIDE, T>) -> Self

Converts to this type from the input type.
Source§

impl<const SIDE: bool, T: Hash> Hash for Endpoint<SIDE, T>

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<const SIDE: bool, T> Neg for Endpoint<SIDE, T>
where T: Neg<Output = T>,

Source§

type Output = Endpoint<SIDE, T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T> Not for Endpoint<LEFT, T>

Source§

type Output = Endpoint<RIGHT, T>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T> Not for Endpoint<RIGHT, T>

Source§

type Output = Endpoint<LEFT, T>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<const SIDE: bool, T: Ord> Ord for Endpoint<SIDE, T>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<const SIDE_L: bool, const SIDE_R: bool, T: PartialEq> PartialEq<Endpoint<SIDE_R, T>> for Endpoint<SIDE_L, T>

Source§

fn eq(&self, other: &Endpoint<SIDE_R, T>) -> 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<const SIDE: bool, T> PartialEq<T> for Endpoint<SIDE, T>
where T: PartialEq + Clone,

Source§

fn eq(&self, point: &T) -> 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<const SIDE_L: bool, const SIDE_R: bool, T: PartialOrd> PartialOrd<Endpoint<SIDE_R, T>> for Endpoint<SIDE_L, T>

Source§

fn partial_cmp(&self, other: &Endpoint<SIDE_R, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<const SIDE: bool, T> PartialOrd<T> for Endpoint<SIDE, T>
where T: PartialOrd + Clone,

Source§

fn partial_cmp(&self, point: &T) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T, U, Z> Sub<Endpoint<LEFT, U>> for Endpoint<RIGHT, T>
where T: Sub<U, Output = Z>,

Source§

type Output = Endpoint<RIGHT, Z>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Endpoint<LEFT, U>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, U, Z> Sub<Endpoint<RIGHT, U>> for Endpoint<LEFT, T>
where T: Sub<U, Output = Z>,

Source§

type Output = Endpoint<LEFT, Z>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Endpoint<RIGHT, U>) -> Self::Output

Performs the - operation. Read more
Source§

impl<const SIDE: bool, T: Copy> Copy for Endpoint<SIDE, T>

Source§

impl<const SIDE: bool, T: Eq> Eq for Endpoint<SIDE, T>

Auto Trait Implementations§

§

impl<const SIDE: bool, T> Freeze for Endpoint<SIDE, T>
where T: Freeze,

§

impl<const SIDE: bool, T> RefUnwindSafe for Endpoint<SIDE, T>
where T: RefUnwindSafe,

§

impl<const SIDE: bool, T> Send for Endpoint<SIDE, T>
where T: Send,

§

impl<const SIDE: bool, T> Sync for Endpoint<SIDE, T>
where T: Sync,

§

impl<const SIDE: bool, T> Unpin for Endpoint<SIDE, T>
where T: Unpin,

§

impl<const SIDE: bool, T> UnwindSafe for Endpoint<SIDE, T>
where T: 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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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, 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.