#![no_std]
#![warn(clippy::pedantic)]
#![allow(clippy::missing_errors_doc)]
#[allow(type_alias_bounds)]
pub type CountRaw<C: Counter> = <<C as Counter>::Reader as CountReader>::RawData;
pub trait Counter {
type Reader: CountReader;
type Resolution;
type Measure;
fn update_count_state(&mut self, count: CountRaw<Self>) -> Result<(), <Self::Reader as CountReader>::ReadErr>;
fn read_count_state(&self) -> &CountRaw<Self>;
fn try_update_count(&mut self) -> Result<(), <Self::Reader as CountReader>::ReadErr>;
fn try_read_measure(
&self,
) -> Result<Self::Measure, <Self::Reader as CountReader>::ReadErr>;
fn measure_count_state(&self) -> Self::Measure;
fn try_update_and_measure(&mut self, count: &CountRaw<Self>) -> Result<Self::Measure, <Self::Reader as CountReader>::ReadErr>;
fn direct_measure() -> Result<Self::Measure, <Self::Reader as CountReader>::ReadErr> {
Ok(Self::measure_count(&<Self::Reader as CountReader>::read()?))
}
fn measure_count(count: &CountRaw<Self>) -> Self::Measure;
}
pub trait CountReader {
type ReadErr;
type RawData;
fn read() -> Result<Self::RawData, Self::ReadErr>;
}