Struct stats::MinMax

source ·
pub struct MinMax<T> { /* private fields */ }
Expand description

A commutative data structure for tracking minimum and maximum values.

This also stores the number of samples.

Implementations§

Create an empty state where min and max values do not exist.

Examples found in repository?
src/minmax.rs (line 109)
108
109
110
111
112
    fn from_iter<I: IntoIterator<Item = T>>(it: I) -> MinMax<T> {
        let mut v = MinMax::new();
        v.extend(it);
        v
    }

Add a sample to the data.

Examples found in repository?
src/minmax.rs (line 119)
117
118
119
120
121
    fn extend<I: IntoIterator<Item = T>>(&mut self, it: I) {
        for sample in it {
            self.add(sample);
        }
    }

Returns the minimum of the data set.

None is returned if and only if the number of samples is 0.

Returns the maximum of the data set.

None is returned if and only if the number of samples is 0.

Returns the number of data points.

Returns true if there are no data points.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Merges the value other into self.
Merges the values in the iterator into self.
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Extends a collection with the contents of an iterator. Read more
🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.