Struct stats::MinMax
[−]
[src]
pub struct MinMax<T> { /* fields omitted */ }
A commutative data structure for tracking minimum and maximum values.
This also stores the number of samples.
Methods
impl<T: PartialOrd + Clone> MinMax<T>
[src]
pub fn new() -> MinMax<T>
[src]
Create an empty state where min and max values do not exist.
pub fn add(&mut self, sample: T)
[src]
Add a sample to the data.
pub fn min(&self) -> Option<&T>
[src]
Returns the minimum of the data set.
None
is returned if and only if the number of samples is 0
.
pub fn max(&self) -> Option<&T>
[src]
Returns the maximum of the data set.
None
is returned if and only if the number of samples is 0
.
pub fn len(&self) -> usize
[src]
Returns the number of data point.
Trait Implementations
impl<T: Clone> Clone for MinMax<T>
[src]
fn clone(&self) -> MinMax<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialOrd> Commute for MinMax<T>
[src]
fn merge(&mut self, v: MinMax<T>)
[src]
Merges the value other
into self
.
fn consume<I: Iterator<Item = Self>>(&mut self, other: I)
[src]
Merges the values in the iterator into self
.
impl<T: PartialOrd> Default for MinMax<T>
[src]
impl<T: Debug> Debug for MinMax<T>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: PartialOrd + Clone> FromIterator<T> for MinMax<T>
[src]
fn from_iter<I: IntoIterator<Item = T>>(it: I) -> MinMax<T>
[src]
Creates a value from an iterator. Read more
impl<T: PartialOrd + Clone> Extend<T> for MinMax<T>
[src]
fn extend<I: IntoIterator<Item = T>>(&mut self, it: I)
[src]
Extends a collection with the contents of an iterator. Read more