Trait Histogram

Source
pub trait Histogram {
    // Required methods
    fn increment_index_by(
        &mut self,
        index: usize,
        count: usize,
    ) -> Result<(), HistErrors>;
    fn hist(&self) -> &Vec<usize>;
    fn reset(&mut self);

    // Provided methods
    fn increment_index(&mut self, index: usize) -> Result<(), HistErrors> { ... }
    fn bin_count(&self) -> usize { ... }
    fn any_bin_zero(&self) -> bool { ... }
}
Expand description

§Implements histogram

  • anything that implements Histogram should also implement the trait HistogramVal

Required Methods§

Source

fn increment_index_by( &mut self, index: usize, count: usize, ) -> Result<(), HistErrors>

§self.hist[index] += count, Err() if index out of bounds
Source

fn hist(&self) -> &Vec<usize>

§the created histogram
Source

fn reset(&mut self)

reset the histogram to zero

Provided Methods§

Source

fn increment_index(&mut self, index: usize) -> Result<(), HistErrors>

§self.hist[index] += 1, Err() if index out of bounds
Source

fn bin_count(&self) -> usize

§How many bins the histogram contains
Source

fn any_bin_zero(&self) -> bool

check if any bin was not hit yet

Implementors§