#![doc = include_str!("application.md")]
#![no_std]
mod aggregate;
mod counter;
mod histogram;
mod ratio;
mod state;
mod summary;
pub use aggregate::{MeasurementAggregate, MeasurementInterval, MeasurementIntervalError};
pub use counter::{MeasurementCounter, MeasurementCounterError};
pub use histogram::{
HistogramBoundsError, HistogramMergeError, HistogramQueryError, HistogramRange,
MeasurementHistogram,
};
pub use ratio::{MeasurementRatioError, checked_scaled_ratio};
pub use state::MeasurementStateError;
pub use summary::{MeasurementMeanError, MeasurementSummary};
const fn add_count(value: &mut u64, saturated: &mut bool, increment: u64) {
if let Some(next) = value.checked_add(increment) {
*value = next;
} else {
*value = u64::MAX;
*saturated = true;
}
}
const fn add_total(value: &mut u128, saturated: &mut bool, increment: u128) {
if let Some(next) = value.checked_add(increment) {
*value = next;
} else {
*value = u128::MAX;
*saturated = true;
}
}