Skip to main content

GptHeader

Struct GptHeader 

Source
pub struct GptHeader {
Show 13 fields pub revision: u32, pub header_size: u32, pub header_crc32: u32, pub header_crc_valid: bool, pub my_lba: u64, pub alternate_lba: u64, pub first_usable_lba: u64, pub last_usable_lba: u64, pub disk_guid: Guid, pub partition_entry_lba: u64, pub num_partition_entries: u32, pub partition_entry_size: u32, pub partition_array_crc32: u32,
}
Expand description

A parsed GPT header.

Fields§

§revision: u32

Header revision (e.g. 0x0001_0000 for v1.0).

§header_size: u32

Header size in bytes (spec value: 92).

§header_crc32: u32

The CRC-32 stored in the header.

§header_crc_valid: bool

true when the stored CRC matches a recomputed CRC over the header.

§my_lba: u64

LBA of this header (1 for primary; last LBA for backup).

§alternate_lba: u64

LBA of the other (backup/primary) header.

§first_usable_lba: u64

First LBA usable by partitions.

§last_usable_lba: u64

Last LBA usable by partitions.

§disk_guid: Guid

Disk GUID.

§partition_entry_lba: u64

LBA where the partition entry array begins.

§num_partition_entries: u32

Number of entries in the partition array.

§partition_entry_size: u32

Size of each partition entry, in bytes (spec value: 128).

§partition_array_crc32: u32

CRC-32 of the partition entry array.

Implementations§

Source§

impl GptHeader

Source

pub fn parse(sector: &[u8]) -> Result<GptHeader, Error>

Parse a GPT header from the start of sector.

§Errors

Error::TooShort if sector is under 92 bytes; Error::BadSignature if it does not begin with "EFI PART".

Trait Implementations§

Source§

impl Clone for GptHeader

Source§

fn clone(&self) -> GptHeader

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 Debug for GptHeader

Source§

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

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

impl Eq for GptHeader

Source§

impl PartialEq for GptHeader

Source§

fn eq(&self, other: &GptHeader) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for GptHeader

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.