gpt::partition

Function read_partitions

Source
pub fn read_partitions(
    path: impl AsRef<Path>,
    header: &Header,
    lb_size: LogicalBlockSize,
) -> Result<BTreeMap<u32, Partition>>
Expand description

Read a GPT partition table.

ยงExample

use gpt::{header, disk, partition};
use std::path::Path;

let lb_size = disk::DEFAULT_SECTOR_SIZE;
let diskpath = Path::new("/dev/sdz");
let hdr = header::read_header(diskpath, lb_size).unwrap();
let partitions = partition::read_partitions(diskpath, &hdr, lb_size).unwrap();
println!("{:#?}", partitions);