use crate::constants::FspTransactKind;
#[derive(Debug, Copy, Clone)]
pub struct DebugMode(u32);
impl Default for DebugMode {
fn default() -> Self {
DebugMode::none()
}
}
impl DebugMode {
pub const fn none() -> Self {
Self(0)
}
pub const fn all() -> Self {
Self(u32::MAX)
}
pub const fn enable_kind(self, kind: FspTransactKind) -> Self {
Self(self.0 | (1 << kind as usize))
}
pub const fn disable_kind(self, kind: FspTransactKind) -> Self {
Self(self.0 & !(1 << kind as usize))
}
}
impl From<DebugMode> for u32 {
fn from(d: DebugMode) -> Self {
d.0
}
}