[−][src]Enum oner_quantize::Interval
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
A lower bound, such as < 100
A half-open exclusive range, such as >= 100 and < 200
aka [100,200)
An upper range, such as >= 200
The interval that covers all values
Methods
impl<A, C> Interval<A, C> where
A: PartialOrd + Copy,
C: Copy,
[src]
A: PartialOrd + Copy,
C: Copy,
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,
A: RefUnwindSafe,
C: RefUnwindSafe,
impl<A, C> Send for Interval<A, C> where
A: Send,
C: Send,
A: Send,
C: Send,
impl<A, C> Sync for Interval<A, C> where
A: Sync,
C: Sync,
A: Sync,
C: Sync,
impl<A, C> Unpin for Interval<A, C> where
A: Unpin,
C: Unpin,
A: Unpin,
C: Unpin,
impl<A, C> UnwindSafe for Interval<A, C> where
A: UnwindSafe,
C: UnwindSafe,
A: UnwindSafe,
C: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,