Skip to main content

PartitionTable

Enum PartitionTable 

Source
pub enum PartitionTable {
    Mbr(MasterBootRecord),
    Gpt {
        protective_mbr: MasterBootRecord,
        gpt: GptDisk,
    },
    Hybrid {
        hybrid_mbr: MasterBootRecord,
        gpt: GptDisk,
    },
}
Available on crate feature alloc only.
Expand description

A unified partition scheme that can be MBR, GPT, or Hybrid.

Variants§

§

Mbr(MasterBootRecord)

Pure MBR partitioning.

§

Gpt

GPT partitioning with protective MBR.

Fields

§protective_mbr: MasterBootRecord

The protective MBR.

§gpt: GptDisk

The GPT disk structure.

§

Hybrid

Hybrid MBR + GPT partitioning.

Fields

§hybrid_mbr: MasterBootRecord

The hybrid MBR.

§gpt: GptDisk

The GPT disk structure.

Implementations§

Source§

impl PartitionTable

Source

pub fn new_mbr() -> Self

Creates a new MBR-only partition scheme.

Source

pub fn new_gpt(disk_sectors: u64, block_size: u32) -> Self

Creates a new GPT partition scheme.

Source

pub fn scheme_type(&self) -> PartitionSchemeType

Returns the partition scheme type.

Source

pub fn partitions(&self) -> Vec<PartitionInfo>

Returns partition information for all partitions.

Source

pub fn validate(&self) -> Result<()>

Validates the partition scheme.

Trait Implementations§

Source§

impl Clone for PartitionTable

Source§

fn clone(&self) -> PartitionTable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PartitionTable

Source§

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

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

impl PartitionTableReadExt for PartitionTable

Available on crate features read and sync only.
Source§

fn read_from<R: Read + Seek>(reader: &mut R, block_size: u32) -> Result<Self>

Detects and reads a partition scheme from a disk image. Read more
Source§

impl PartitionTableReadExt for PartitionTable

Available on crate features async and read only.
Source§

async fn read_from<R: Read + Seek>( reader: &mut R, block_size: u32, ) -> Result<Self>

Detects and reads a partition scheme from a disk image. Read more
Source§

impl PartitionTableWriteExt for PartitionTable

Available on crate features sync and write only.
Source§

fn write_to<W: Write + Seek>(&self, writer: &mut W) -> Result<()>

Writes the partition scheme to a writer. Read more
Source§

impl PartitionTableWriteExt for PartitionTable

Available on crate features async and write only.
Source§

async fn write_to<W: Write + Seek>(&self, writer: &mut W) -> Result<()>

Writes the partition scheme to a writer. Read more

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, 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.