[][src]Struct gpt::GptDisk

pub struct GptDisk { /* fields omitted */ }

A file-backed GPT disk.

Methods

impl GptDisk[src]

pub fn add_partition(
    &mut self,
    name: &str,
    size: u64,
    part_type: Type,
    flags: u64
) -> Result<u32>
[src]

Add another partition to this disk. This tries to find the optimum partition location with the lowest block device. Returns the new partition id if there was sufficient room to add the partition. Size is specified in bytes.

pub fn find_free_sectors(&self) -> Vec<(u64, u64)>[src]

Find free space on the disk. Returns a tuple of (starting_lba, length in lba's).

pub fn find_next_partition_id(&self) -> u32[src]

Find next highest partition id.

pub fn primary_header(&self) -> Option<&Header>[src]

Retrieve primary header, if any.

pub fn backup_header(&self) -> Option<&Header>[src]

Retrieve backup header, if any.

pub fn partitions(&self) -> &BTreeMap<u32, Partition>[src]

Retrieve partition entries.

pub fn guid(&self) -> &Uuid[src]

Retrieve disk UUID.

pub fn logical_block_size(&self) -> &LogicalBlockSize[src]

Retrieve disk logical block size.

pub fn update_guid(&mut self, uuid: Option<Uuid>) -> Result<&Self>[src]

Update disk UUID.

If no UUID is specified, a new random one is generated. No changes are recorded to disk until write() is called.

pub fn update_partitions(
    &mut self,
    pp: BTreeMap<u32, Partition>
) -> Result<&Self>
[src]

Update current partition table.

No changes are recorded to disk until write() is called.

pub fn write(self) -> Result<File>[src]

Persist state to disk, consuming this disk object.

This is a destructive action, as it overwrite headers and partitions entries on disk. All writes are flushed to disk before returning the underlying File object.

Trait Implementations

impl Debug for GptDisk[src]

Auto Trait Implementations

impl Send for GptDisk

impl Sync for GptDisk

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.