1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
/// Estimate a statistic of a sequence of numbers ("population").
pub trait Estimate {
    /// Add an observation sampled from the population.
    fn add(&mut self, x: f64);

    /// Estimate the statistic of the population.
    fn estimate(&self) -> f64;
}

/// Merge another sample into this one.
pub trait Merge {
    fn merge(&mut self, other: &Self);
}