Crate bootsector [] [src]

Read basic MBR and GPT partition tables from a reader.

Examples

Load MBR or GPT partitions from a reader:

use std::io;
use bootsector::{list_partitions, open_partition, Options, Attributes};

// let reader = ...;
let partitions = list_partitions(&mut reader, &Options::default())?;
let part = &partitions[0];

// See what type of partition this is
match part.attributes {
    Attributes::GPT {
        type_uuid,
        ..
    } => println!("gpt: {:?}", type_uuid),
    Attributes::MBR {
        type_code,
        ..
    } => println!("mbr: {:x}", type_code),
}

let part_reader = open_partition(reader, part);
// part_reader.read_exact(...

Structs

Options

Configuration for listing partitions.

Partition

An entry in the partition table.

Enums

Attributes

Table-specific information about a partition.

ReadGPT

What type of GPT partition tables should we attempt to read?

ReadMBR

What type of MBR partition tables should we attempt to read?

SectorSize

Settings for handling sector size

Functions

list_partitions

Read the list of partitions.

open_partition

Open the contents of a partition for reading.