use std::fmt;
use crate::{time::SystemInstant, Measurement};
#[cfg(feature = "register-recorder")]
pub mod recorder;
pub type IndexValue = u64;
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Index(IndexValue);
impl Index {
#[must_use]
pub const fn new(value: IndexValue) -> Self {
Self(value)
}
#[must_use]
pub const fn to_value(self) -> IndexValue {
let Index(value) = self;
value
}
}
impl From<IndexValue> for Index {
fn from(from: IndexValue) -> Self {
Self::new(from)
}
}
impl From<Index> for IndexValue {
fn from(from: Index) -> Self {
from.to_value()
}
}
impl fmt::Display for Index {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "#{}", self.to_value())
}
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct IndexedMeasurement<Value> {
pub index: Index,
pub measurement: Measurement<Value>,
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct ObservedValue<Value> {
pub observed_at: SystemInstant,
pub value: Value,
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct ObservedValues<Value> {
pub observed_at: SystemInstant,
pub values: Vec<Option<Value>>,
}