sdmmc-core 0.5.0

SD/MMC core data structures and algorithms
Documentation
use crate::lib_bool_enum;
use crate::result::Result;

lib_bool_enum! {
    /// Represents the `BARRIER` sub-field of the [FlushCache](super::FlushCache) field.
    Barrier {
        /// Represents the reset value of the [Barrier] sub-field.
        ResetValue = false,
        /// Sets the cache barrier. All data cached before the barrier is flushed to nonvolatile memory.
        SetBarrier = true,
    }
}

impl Barrier {
    /// Converts an inner representation into a [Barrier].
    pub const fn try_from_inner(val: bool) -> Result<Self> {
        Ok(Self::from_bool(val))
    }

    /// Converts a [Barrier] into an inner representation.
    pub const fn into_inner(self) -> bool {
        self.into_bool()
    }
}