sdmmc-core 0.5.0

SD/MMC core data structures and algorithms
Documentation
use crate::lib_enum;
use crate::result::{Error, Result};

lib_enum! {
    /// Represents the file format on the SD memory card.
    FileFormat: u8 {
        default: HardDisk,
        error: Error,
        /// Hard disk-like file system with partition table.
        HardDisk = 0,
        /// DOS FAT (floppy-like) with boot sector only (no partition table).
        Fat = 1,
        /// Universal File Format.
        Universal = 2,
        /// Others/unknown file format.
        Unknown = 3,
    }
}

impl FileFormat {
    /// Attempts to convert an inner representation into a [FileFormat].
    pub const fn try_from_inner(val: u8) -> Result<Self> {
        Self::from_raw(val)
    }

    /// Converts a [FileFormat] into an inner representation.
    pub const fn into_inner(self) -> u8 {
        self.into_raw()
    }
}