Macro average::define_histogram[][src]

macro_rules! define_histogram {
    ($name:ident, $LEN:expr) => { ... };
}

Define a histogram with a number of bins known at compile time.

use average::Histogram;

define_histogram!(Histogram10, 10);
let mut h = Histogram10::with_const_width(0., 100.);
for i in 0..100 {
    h.add(i as f64).unwrap();
}
assert_eq!(h.bins(), &[10, 10, 10, 10, 10, 10, 10, 10, 10, 10]);