Enum PartitionKind

Source
#[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

§Extended Partitions

§Linux File Systems

§Other File Systems

§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

Source

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);
}
Source

pub fn to_u8(&self) -> u8

Convert the partition type to its raw u8 value

Source

pub fn get_name(&self) -> &'static str

Get the human-readable name of the partition type

Source

pub fn is_fat(&self) -> bool

Check if this partition type is a FAT filesystem

Source

pub fn is_hidden(&self) -> bool

Check if this partition type is hidden

Source

pub fn is_extended(&self) -> bool

Check if this partition type is an extended partition

Source

pub fn is_linux(&self) -> bool

Check if this partition type is Linux-related

Trait Implementations§

Source§

impl Clone for PartitionKind

Source§

fn clone(&self) -> PartitionKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PartitionKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PartitionKind

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PartitionKind

Source§

fn eq(&self, other: &PartitionKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for PartitionKind

Source§

impl Eq for PartitionKind

Source§

impl StructuralPartialEq for PartitionKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.