hdrhistogram_c/lib.rs
1//! # Rust binding for HdrHistogram_c
2//!
3//! This crate implements bindings for
4//! [HdrHistogram_c](https://github.com/hdrhistogram/HdrHistogram_c), a flexible library for
5//! recording histograms without having to know very much about the data being histogrammed.
6//!
7//! The top-level type is [`Histogram`](struct.Histogram.html).
8//!
9//! # Example
10//!
11//! This sets up a histogram to record values in the range 1..1000_000 with 2 significant figures of
12//! precision. It then records one count each of 1 and 10, and 40 counts of 100.
13//!
14//! ```
15//! # use hdrhistogram_c::Histogram;
16//! let mut h = Histogram::init(1, 1000000, 2).unwrap();
17//!
18//! h.record_value(1);
19//! h.record_value(10);
20//! h.record_values(100, 40);
21//!
22//! assert_eq!(h.total_count(), 42);
23//! assert_eq!(h.min(), 1);
24//! assert_eq!(h.max(), 100);
25//! ```
26
27mod ffi;
28
29pub use ffi::{Histogram, HistogramErr, LinearIter, LogIter, PercentileIter, RecordedIter,
30 CountIterItem, PercentileIterItem };
31
32
33/// Result from operations which may fail.
34pub type Result<T> = std::result::Result<T, HistogramErr>;