use crate::messages::primitive_aliases::Code2;
use std::fmt::Debug;
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct Summary(Code2);
impl Summary {
pub(crate) fn new(code: Code2) -> Self {
Self(code)
}
pub fn none(&self) -> bool {
self.0 == 0
}
pub fn tower_utilities(&self) -> bool {
self.0 & 0b0001 != 0
}
pub fn pedestal(&self) -> bool {
self.0 & 0b0010 != 0
}
pub fn transmitter(&self) -> bool {
self.0 & 0b0100 != 0
}
pub fn receiver(&self) -> bool {
self.0 & 0b1000 != 0
}
pub fn rda_control(&self) -> bool {
self.0 & 0b10000 != 0
}
pub fn communication(&self) -> bool {
self.0 & 0b100000 != 0
}
pub fn signal_processor(&self) -> bool {
self.0 & 0b1000000 != 0
}
}
impl Debug for Summary {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Summary")
.field("none", &self.none())
.field("tower_utilities", &self.tower_utilities())
.field("pedestal", &self.pedestal())
.field("transmitter", &self.transmitter())
.field("receiver", &self.receiver())
.field("rda_control", &self.rda_control())
.field("communication", &self.communication())
.field("signal_processor", &self.signal_processor())
.finish()
}
}