Skip to main content

GptDiskWriteExt

Trait GptDiskWriteExt 

Source
pub trait GptDiskWriteExt {
    // Required methods
    fn write_to<W: Write + Seek>(&self, writer: &mut W) -> Result<()>;
    fn write_to_with_mbr<W: Write + Seek>(
        &self,
        writer: &mut W,
        mbr: &MasterBootRecord,
    ) -> Result<()>;
}
Available on crate features alloc and write only.
Expand description

Extension trait for writing GptDisk to I/O sinks.

Required Methods§

Source

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

Writes the complete GPT structure to a writer.

Writes:

  1. Protective MBR at LBA 0
  2. Primary GPT header at LBA 1
  3. Primary partition entry array starting at LBA 2
  4. Backup partition entry array before backup header
  5. Backup GPT header at the last LBA
§Arguments
  • writer - The writer to write to
§Errors

Returns an error if writing fails.

Source

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

Writes the complete GPT structure with a custom MBR.

This is useful for hybrid MBR configurations.

§Arguments
  • writer - The writer to write to
  • mbr - The MBR to write (protective or hybrid)
§Errors

Returns an error if writing fails.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl GptDiskWriteExt for GptDisk

Available on crate feature sync only.