Struct hanower::Interval[][src]

pub struct Interval { /* fields omitted */ }

Used to create and work with intervals which are calculated from the user-input CLI values.

  • low is the starting point of the section from which to find intervals
  • high is the inclusive end point of the section from which to find intervals
  • count is the total number of desired intervals to be calculated
    • must be a minimum of 2 (low and high)

Implementations

impl Interval[src]

pub fn new(low: f64, high: f64, count: u64) -> Result<Self, IntervalError>[src]

Creates a new Interval, with the range low..=high, split into count number of intervals.

pub fn low(&self) -> f64[src]

Returns the low value.

pub fn high(&self) -> f64[src]

Returns the high value.

pub fn count(&self) -> u64[src]

Returns the count value.

pub fn bucket(&self, number: f64) -> Option<usize>[src]

Finds the bucket a given value exists in.

A bucket refers to a range between two values, and including the starting value.

For example, say we have values of low = 1, high = 10, and count = 5, and want to know which bucket the number 8 would be in. The output intervals would be 2 3 4 6 10. The first bucket is then 2..<3, next 3..<4, etc. So, 8 is in the fourth bucket, between 6 and 10.

pub fn iter(&self) -> IntervalIter

Notable traits for IntervalIter

impl Iterator for IntervalIter type Item = f64;
[src]

Returns an iterator of lazily evaluated intervals, starting from this Interval’s low value up to and including the high value.

pub fn intervals(&self) -> IntervalIter

Notable traits for IntervalIter

impl Iterator for IntervalIter type Item = f64;
[src]

Returns an iterator of lazily evaluated intervals based on the low and high points of this Interval, and skips the floor value.

Trait Implementations

impl Clone for Interval[src]

impl Copy for Interval[src]

impl Debug for Interval[src]

Auto Trait Implementations

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.