#[repr(u8)]pub enum PartitionKind {
Show 24 variants
Empty = 0,
Fat12 = 1,
Fat16Small = 4,
Extended = 5,
Fat16 = 6,
NtfsExfat = 7,
Fat32 = 11,
Fat32Lba = 12,
Fat16Lba = 14,
ExtendedLba = 15,
HiddenFat12 = 17,
HiddenFat16Small = 20,
HiddenFat16 = 22,
HiddenNtfsExfat = 23,
HiddenFat32 = 27,
HiddenFat32Lba = 28,
HiddenFat16Lba = 30,
LinuxSwap = 130,
Linux = 131,
LinuxLvm = 142,
GptProtective = 238,
EfiSystem = 239,
Xila = 218,
Unknown(u8),
}
Expand description
MBR partition type enumeration with comprehensive type definitions.
This enum represents the partition type field in MBR partition entries. Each variant corresponds to a specific file system type or partition purpose as defined by the standard PC partition type IDs.
§Standard Partition Types
§FAT File Systems
PartitionKind::Fat12
- FAT12 file system (floppy disks, small partitions)PartitionKind::Fat16
- FAT16 file systemPartitionKind::Fat16Small
- FAT16 for partitions < 32MBPartitionKind::Fat32
- FAT32 file systemPartitionKind::Fat32Lba
- FAT32 with LBA addressing (recommended)
§Extended Partitions
PartitionKind::Extended
- Extended partition (CHS addressing)PartitionKind::ExtendedLba
- Extended partition (LBA addressing)
§Linux File Systems
PartitionKind::Linux
- Linux native partition (typically ext2/3/4)PartitionKind::LinuxSwap
- Linux swap partitionPartitionKind::LinuxLvm
- Linux LVM (Logical Volume Manager)
§Other File Systems
PartitionKind::NtfsExfat
- NTFS or exFAT file systemPartitionKind::EfiSystem
- EFI System PartitionPartitionKind::GptProtective
- GPT protective partition
§Examples
use file_system::*;
let partition_type = Partition_type_type::Fat32_lba;
assert!(partition_type.is_fat());
assert!(!partition_type.is_extended());
let linux_type = Partition_type_type::From_u8(0x83);
assert_eq!(linux_type, Partition_type_type::Linux);
Variants§
Empty = 0
Empty/unused partition slot
Fat12 = 1
FAT12 file system
Fat16Small = 4
FAT16 file system (small partitions < 32MB)
Extended = 5
Extended partition (CHS addressing)
Fat16 = 6
FAT16 file system
NtfsExfat = 7
NTFS or exFAT file system
Fat32 = 11
FAT32 file system (CHS addressing)
Fat32Lba = 12
FAT32 file system (LBA addressing - recommended)
Fat16Lba = 14
FAT16 file system (LBA addressing)
ExtendedLba = 15
Extended partition (LBA addressing)
HiddenFat12 = 17
Hidden FAT12 partition
HiddenFat16Small = 20
Hidden FAT16 partition (small)
HiddenFat16 = 22
Hidden FAT16 partition
HiddenNtfsExfat = 23
Hidden NTFS/exFAT partition
HiddenFat32 = 27
Hidden FAT32 partition
HiddenFat32Lba = 28
Hidden FAT32 partition (LBA addressing)
HiddenFat16Lba = 30
Hidden FAT16 partition (LBA addressing)
LinuxSwap = 130
Linux swap partition
Linux = 131
Linux native partition (typically ext2/3/4)
LinuxLvm = 142
Linux LVM (Logical Volume Manager)
GptProtective = 238
GPT protective partition (indicates GPT, not MBR)
EfiSystem = 239
EFI System Partition
Xila = 218
Xila
Unknown(u8)
Unknown or custom partition type
Implementations§
Source§impl PartitionKind
impl PartitionKind
Sourcepub fn from_u8(value: u8) -> Self
pub fn from_u8(value: u8) -> Self
Create a partition type from a raw u8 value.
This function maps standard partition type IDs to their corresponding
enum variants. Unknown types are wrapped in PartitionKind::Unknown
.
§Arguments
Value
- The raw partition type ID from the MBR partition entry
§Returns
The corresponding partition type enum variant.
§Examples
use file_system::*;
assert_eq!(Partition_type_type::From_u8(0x0C), Partition_type_type::Fat32_lba);
assert_eq!(Partition_type_type::From_u8(0x83), Partition_type_type::Linux);
// Unknown types are preserved
if let Partition_type_type::Unknown(id) = Partition_type_type::From_u8(0xFF) {
assert_eq!(id, 0xFF);
}
Check if this partition type is hidden
Sourcepub fn is_extended(&self) -> bool
pub fn is_extended(&self) -> bool
Check if this partition type is an extended partition
Trait Implementations§
Source§impl Clone for PartitionKind
impl Clone for PartitionKind
Source§fn clone(&self) -> PartitionKind
fn clone(&self) -> PartitionKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more