use std::fmt;
use std::ops::Deref;
#[derive(Debug)]
pub struct Observation<ObservableState> {
pub obs_type: ObservationType,
pub state: ObservableState,
}
impl<ObservableState> Deref for Observation<ObservableState> {
type Target = ObservableState;
fn deref(&self) -> &Self::Target {
&self.state
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum ObservationType {
Alive,
Timeout,
PostMortem,
}
impl<State: fmt::Debug + PartialEq> PartialEq for Observation<State> {
fn eq(&self, other: &Self) -> bool {
self.obs_type.eq(&other.obs_type) && self.state.eq(&other.state)
}
}
impl<State: fmt::Debug + PartialEq + Eq> Eq for Observation<State> {}