Struct hanower::Interval [−][src]
pub struct Interval { /* fields omitted */ }
Expand description
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 1 (prints interval of
low
tohigh
)
- must be a minimum of 1 (prints interval of
Note: values are rounded to 12 significant decimal places.
Implementations
impl Interval
[src]
impl Interval
[src]pub fn new(low: f64, high: f64, count: u64) -> Result<Self, IntervalError>
[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 bucket(&self, number: f64) -> Option<usize>
[src]
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 (similar to an interval).
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 1 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]
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]
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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnwindSafe for Interval
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more