[][src]Enum oner_quantize::Interval

pub enum Interval<A, C> {
    Lower {
        below: A,
        class: C,
    },
    Range {
        from: A,
        below: A,
        class: C,
    },
    Upper {
        from: A,
        class: C,
    },
    Infinite {
        class: C,
    },
}

An interval represents a mapping from a range of values of type A, to a class, C.

Examples

use oner_quantize::Interval;
let interval = Interval::lower(100, "true");
assert_eq!(interval.matches(25), true);
assert_eq!(interval.matches(100), false);
assert_eq!(interval.matches(125), false);

Variants

Lower

A lower bound, such as < 100

Fields of Lower

below: Aclass: C
Range

A half-open exclusive range, such as >= 100 and < 200 aka [100,200)

Fields of Range

from: Abelow: Aclass: C
Upper

An upper range, such as >= 200

Fields of Upper

from: Aclass: C
Infinite

The interval that covers all values

Fields of Infinite

class: C

Methods

impl<A, C> Interval<A, C> where
    A: PartialOrd + Copy,
    C: Copy
[src]

pub fn lower(below: A, class: C) -> Self[src]

pub fn range(from: A, below: A, class: C) -> Self[src]

pub fn upper(from: A, class: C) -> Self[src]

pub fn matches(&self, value: A) -> bool[src]

Does the given value fall inside this interval?

pub fn class(&self) -> &C[src]

The class that this interval predicts.

Trait Implementations

impl<A: Clone, C: Clone> Clone for Interval<A, C>[src]

impl<A: Copy, C: Copy> Copy for Interval<A, C>[src]

impl<A: Debug, C: Debug> Debug for Interval<A, C>[src]

impl<A: PartialEq, C: PartialEq> PartialEq<Interval<A, C>> for Interval<A, C>[src]

impl<A, C> StructuralPartialEq for Interval<A, C>[src]

Auto Trait Implementations

impl<A, C> RefUnwindSafe for Interval<A, C> where
    A: RefUnwindSafe,
    C: RefUnwindSafe

impl<A, C> Send for Interval<A, C> where
    A: Send,
    C: Send

impl<A, C> Sync for Interval<A, C> where
    A: Sync,
    C: Sync

impl<A, C> Unpin for Interval<A, C> where
    A: Unpin,
    C: Unpin

impl<A, C> UnwindSafe for Interval<A, C> where
    A: UnwindSafe,
    C: UnwindSafe

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.