use crate::{Error, lib_enum};
lib_enum! {
VideoSpeedClass: u8 {
default: LegacyUHS,
error: Error,
LegacyUHS = 0b0,
Video = 0b1,
}
}
impl VideoSpeedClass {
pub const fn from_bool(val: bool) -> Self {
match val {
false => Self::LegacyUHS,
true => Self::Video,
}
}
pub const fn into_bool(&self) -> bool {
match self {
Self::LegacyUHS => false,
Self::Video => true,
}
}
}
impl From<bool> for VideoSpeedClass {
fn from(val: bool) -> Self {
Self::from_bool(val)
}
}
impl From<VideoSpeedClass> for bool {
fn from(val: VideoSpeedClass) -> Self {
val.into_bool()
}
}