use crate::lib_bool_enum;
use crate::result::Result;
lib_bool_enum! {
/// Represents the `PERM_WRITE_PROTECT` field of the `CSD` register.
PermanentWriteProtect {
/// Indicates that permanent write protection is disabled.
Disabled = false,
/// Indicates that permanent write protection is enabled.
Enabled = true,
}
}
impl PermanentWriteProtect {
/// Converts an inner representation into a [PermanentWriteProtect].
pub const fn from_inner(val: bool) -> Self {
Self::from_bool(val)
}
/// Attempts to convert an inner representation into a [PermanentWriteProtect].
pub const fn try_from_inner(val: bool) -> Result<Self> {
Ok(Self::from_bool(val))
}
/// Converts a [PermanentWriteProtect] into an inner representation.
pub const fn into_inner(self) -> bool {
self.into_bool()
}
}