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]
impl<T: PartialOrd + Clone> MinMax<T>pub fn new() -> MinMax<T>[src]
pub fn new() -> MinMax<T>Create an empty state where min and max values do not exist.
pub fn add(&mut self, sample: T)[src]
pub fn add(&mut self, sample: T)Add a sample to the data.
pub fn min(&self) -> Option<&T>[src]
pub fn min(&self) -> Option<&T>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]
pub fn max(&self) -> Option<&T>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]
pub fn len(&self) -> usizeReturns the number of data point.
Trait Implementations
impl<T: Clone> Clone for MinMax<T>[src]
impl<T: Clone> Clone for MinMax<T>fn clone(&self) -> MinMax<T>[src]
fn clone(&self) -> MinMax<T>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
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]
impl<T: PartialOrd> Commute for MinMax<T>fn merge(&mut self, v: MinMax<T>)[src]
fn merge(&mut self, v: MinMax<T>)Merges the value other into self.
fn consume<I: Iterator<Item = Self>>(&mut self, other: I)[src]
fn consume<I: Iterator<Item = Self>>(&mut self, other: I)Merges the values in the iterator into self.
impl<T: PartialOrd> Default for MinMax<T>[src]
impl<T: PartialOrd> Default for MinMax<T>impl<T: Debug> Debug for MinMax<T>[src]
impl<T: Debug> Debug for MinMax<T>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<T: PartialOrd + Clone> FromIterator<T> for MinMax<T>[src]
impl<T: PartialOrd + Clone> FromIterator<T> for MinMax<T>fn from_iter<I: IntoIterator<Item = T>>(it: I) -> MinMax<T>[src]
fn from_iter<I: IntoIterator<Item = T>>(it: I) -> MinMax<T>Creates a value from an iterator. Read more
impl<T: PartialOrd + Clone> Extend<T> for MinMax<T>[src]
impl<T: PartialOrd + Clone> Extend<T> for MinMax<T>fn extend<I: IntoIterator<Item = T>>(&mut self, it: I)[src]
fn extend<I: IntoIterator<Item = T>>(&mut self, it: I)Extends a collection with the contents of an iterator. Read more