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 intervalshigh
is the inclusive end point of the section from which to find intervalscount
is the total number of desired intervals to be calculated- must be a minimum of 2 (
low
andhigh
)
- must be a minimum of 2 (
Implementations
impl Interval
[src]
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]
Notable traits for IntervalIter
impl Iterator for IntervalIter type Item = f64;
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]
Notable traits for IntervalIter
impl Iterator for IntervalIter type Item = f64;
Returns an iterator of lazily evaluated intervals based on the
low
and high points
of this Interval, and skips the floor value.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Interval
impl RefUnwindSafe for Interval
impl UnwindSafe for Interval
impl UnwindSafe for Interval