Skip to main content

file_system/mbr/partition/
kind.rs

1//! Partition type definitions for MBR partition tables.
2
3/// Minimal MBR partition type enumeration.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
5pub enum PartitionKind {
6    /// Empty/unused partition slot (0x00).
7    #[default]
8    Empty,
9    /// Xila filesystem partition (0xDA).
10    Xila,
11    /// Other partition type.
12    Other(u8),
13}
14
15impl From<u8> for PartitionKind {
16    fn from(val: u8) -> Self {
17        match val {
18            0x00 => Self::Empty,
19            0xDA => Self::Xila,
20            other => Self::Other(other),
21        }
22    }
23}
24
25impl From<PartitionKind> for u8 {
26    fn from(kind: PartitionKind) -> Self {
27        match kind {
28            PartitionKind::Empty => 0x00,
29            PartitionKind::Xila => 0xDA,
30            PartitionKind::Other(val) => val,
31        }
32    }
33}