Skip to main content

PartitionInfo

Struct PartitionInfo 

Source
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: usize

Partition index (0-based).

§start_lba: u64

Starting LBA.

§end_lba: u64

Ending LBA (inclusive).

§size_sectors: u64

Size in sectors.

§bootable: bool

Whether the partition is bootable/active.

§partition_type: PartitionType

Partition type (MBR type code or GPT type GUID).

Implementations§

Source§

impl PartitionInfo

Source

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.

Source

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

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Copy for PartitionInfo

Source§

impl Debug for PartitionInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartitionInfoTrait for PartitionInfo

Source§

fn start_lba(&self) -> u64

Returns the starting LBA of the partition.
Source§

fn size_sectors(&self) -> u64

Returns the size of the partition in sectors.
Source§

fn end_lba(&self) -> u64

Returns the ending LBA of the partition (inclusive). Read more
Source§

fn checked_end_lba(&self) -> Option<u64>

Returns the inclusive ending LBA, or None if it overflows.
Source§

fn byte_len(&self, logical_block_size: u32) -> Option<u64>

Returns the partition length in bytes for an explicit logical block size.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.