pub struct PartitionInfo {
pub index: usize,
pub start_lba: u64,
pub end_lba: u64,
pub size_sectors: u64,
pub bootable: bool,
pub partition_type: PartitionType,
}Expand description
Information about a partition, independent of the underlying scheme.
Fields§
§index: usizePartition index (0-based).
start_lba: u64Starting LBA.
end_lba: u64Ending LBA (inclusive).
size_sectors: u64Size in sectors.
bootable: boolWhether the partition is bootable/active.
partition_type: PartitionTypePartition type (MBR type code or GPT type GUID).
Implementations§
Source§impl PartitionInfo
impl PartitionInfo
Sourcepub const fn size_bytes(&self) -> u64
pub const fn size_bytes(&self) -> u64
Returns the size in bytes (assuming 512-byte sectors).
Saturates to u64::MAX on corrupt inputs whose sector count is
not representable in bytes.
Sourcepub const fn size_bytes_with_sector_size(&self, sector_size: u32) -> u64
pub const fn size_bytes_with_sector_size(&self, sector_size: u32) -> u64
Returns the size in bytes for a given sector size.
Saturates to u64::MAX on corrupt inputs whose sector count is
not representable in bytes.
Trait Implementations§
Source§impl Clone for PartitionInfo
impl Clone for PartitionInfo
Source§fn clone(&self) -> PartitionInfo
fn clone(&self) -> PartitionInfo
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PartitionInfo
Source§impl Debug for PartitionInfo
impl Debug for PartitionInfo
Source§impl PartitionInfoTrait for PartitionInfo
impl PartitionInfoTrait for PartitionInfo
Source§fn size_sectors(&self) -> u64
fn size_sectors(&self) -> u64
Returns the size of the partition in sectors.
Source§fn checked_end_lba(&self) -> Option<u64>
fn checked_end_lba(&self) -> Option<u64>
Returns the inclusive ending LBA, or
None if it overflows.Auto Trait Implementations§
impl Freeze for PartitionInfo
impl RefUnwindSafe for PartitionInfo
impl Send for PartitionInfo
impl Sync for PartitionInfo
impl Unpin for PartitionInfo
impl UnsafeUnpin for PartitionInfo
impl UnwindSafe for PartitionInfo
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
Mutably borrows from an owned value. Read more