use core::fmt;
#[cfg(test)]
mod tests;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum MeasurementStateError {
InvalidEmpty,
MissingMaximum,
InvalidSaturation,
InvalidTotal,
InvalidLatest,
InvalidBounds,
InvalidDistribution,
}
impl fmt::Display for MeasurementStateError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(match self {
Self::InvalidEmpty => "nonempty state without observations",
Self::MissingMaximum => "observations without a maximum",
Self::InvalidSaturation => "overflow flag without a clipped cap",
Self::InvalidTotal => "total disagrees with count or maximum",
Self::InvalidLatest => "latest observation disagrees with aggregate",
Self::InvalidBounds => "histogram bounds are not strictly increasing",
Self::InvalidDistribution => "distribution disagrees with aggregate",
})
}
}
impl core::error::Error for MeasurementStateError {}