use crate::aggregate::Metrics;
use crate::source::types::RawPhase;
use std::ops::{Add, AddAssign};
#[derive(Default, Debug)]
pub struct SensorPhase {
pub metrics: Metrics,
}
impl AddAssign for SensorPhase {
fn add_assign(&mut self, rhs: Self) {
self.metrics.extend(rhs.metrics);
}
}
impl Add for SensorPhase {
type Output = SensorPhase;
fn add(mut self, rhs: Self) -> Self::Output {
self += rhs;
self
}
}
impl<V> From<RawPhase<V>> for SensorPhase
where
V: Into<Metrics>,
{
fn from(phase: RawPhase<V>) -> Self {
SensorPhase {
metrics: phase.metrics.into(),
}
}
}