Skip to main content

PartitionTableReadExt

Trait PartitionTableReadExt 

Source
pub trait PartitionTableReadExt: Sized {
    // Required method
    fn read_from<R: Read + Seek>(
        reader: &mut R,
        block_size: u32,
    ) -> Result<Self>;
}
Available on crate features alloc and read only.
Expand description

Extension trait for reading PartitionTable from I/O sources.

Required Methods§

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.

This method:

  1. Reads the MBR at LBA 0
  2. Detects if it’s a protective MBR (GPT) or hybrid MBR
  3. If protective/hybrid, reads the GPT structure
  4. Returns the appropriate partition scheme
§Arguments
  • reader - The reader to read from (should be positioned at LBA 0)
  • block_size - The logical block size in bytes (typically 512)
§Errors

Returns an error if reading fails or if the partition structure is invalid.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl PartitionTableReadExt for PartitionTable

Available on crate feature sync only.