pub struct Partition {
pub part_type_guid: Type,
pub part_guid: Uuid,
pub first_lba: u64,
pub last_lba: u64,
pub flags: u64,
pub name: String,
}
Expand description
A partition entry in a GPT partition table.
Fields§
§part_type_guid: Type
GUID of the partition type.
part_guid: Uuid
UUID of the partition.
first_lba: u64
First LBA of the partition.
last_lba: u64
Last LBA of the partition.
flags: u64
Partition flags.
name: String
Partition name.
Implementations§
Source§impl Partition
impl Partition
Sourcepub fn write(
&self,
p: &Path,
partition_index: u64,
start_lba: u64,
lb_size: LogicalBlockSize,
) -> Result<()>
pub fn write( &self, p: &Path, partition_index: u64, start_lba: u64, lb_size: LogicalBlockSize, ) -> Result<()>
Write the partition entry to the partitions area in the given file. NOTE: does not update partitions array crc32 in the headers!
Sourcepub fn write_to_device<D: DiskDevice>(
&self,
device: &mut D,
partition_index: u64,
start_lba: u64,
lb_size: LogicalBlockSize,
bytes_per_partition: u32,
) -> Result<()>
pub fn write_to_device<D: DiskDevice>( &self, device: &mut D, partition_index: u64, start_lba: u64, lb_size: LogicalBlockSize, bytes_per_partition: u32, ) -> Result<()>
Write the partition entry to the partitions area in the given device. NOTE: does not update partitions array crc32 in the headers!
Sourcepub fn write_zero_entries_to_device<D: DiskDevice>(
device: &mut D,
starting_partition_index: u64,
number_entries: u64,
start_lba: u64,
lb_size: LogicalBlockSize,
bytes_per_partition: u32,
) -> Result<()>
pub fn write_zero_entries_to_device<D: DiskDevice>( device: &mut D, starting_partition_index: u64, number_entries: u64, start_lba: u64, lb_size: LogicalBlockSize, bytes_per_partition: u32, ) -> Result<()>
Write empty partition entries starting at the given index in the partition array for the given number of entries…
Sourcepub fn bytes_len(&self, lb_size: LogicalBlockSize) -> Result<u64>
pub fn bytes_len(&self, lb_size: LogicalBlockSize) -> Result<u64>
Return the length (in bytes) of this partition. Partition size is calculated as (last_lba + 1 - first_lba) * block_size Bounds are inclusive, meaning we add one to account for the full last logical block
Sourcepub fn bytes_start(&self, lb_size: LogicalBlockSize) -> Result<u64>
pub fn bytes_start(&self, lb_size: LogicalBlockSize) -> Result<u64>
Return the starting offset (in bytes) of this partition.
Trait Implementations§
impl Eq for Partition
impl StructuralPartialEq for Partition
Auto Trait Implementations§
impl Freeze for Partition
impl RefUnwindSafe for Partition
impl Send for Partition
impl Sync for Partition
impl Unpin for Partition
impl UnwindSafe for Partition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)