[−][src]Struct gpt::GptDisk
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]
&mut self,
name: &str,
size: u64,
part_type: Type,
flags: u64
) -> Result<u32>
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]
&mut self,
pp: BTreeMap<u32, Partition>
) -> Result<&Self>
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
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,