Struct gpt::header::Header

source ·
pub struct Header {
Show 14 fields pub signature: String, pub revision: u32, pub header_size_le: u32, pub crc32: u32, pub reserved: u32, pub current_lba: u64, pub backup_lba: u64, pub first_usable: u64, pub last_usable: u64, pub disk_guid: Uuid, pub part_start: u64, pub num_parts: u32, pub part_size: u32, pub crc32_parts: u32,
}
Expand description

Header describing a GPT disk.

Fields§

§signature: String

GPT header magic signature, hardcoded to “EFI PART”.

§revision: u32

00 00 01 00

§header_size_le: u32

little endian

§crc32: u32

CRC32 of the header with crc32 section zeroed

§reserved: u32

must be 0

§current_lba: u64

For main header, 1

§backup_lba: u64

LBA for backup header

§first_usable: u64

First usable LBA for partitions (primary table last LBA + 1)

§last_usable: u64

Last usable LBA (secondary partition table first LBA - 1)

§disk_guid: Uuid

UUID of the disk

§part_start: u64

Starting LBA of partition entries

§num_parts: u32

Number of partition entries

§part_size: u32

Size of a partition entry, usually 128

§crc32_parts: u32

CRC32 of the partition table

Implementations§

source§

impl Header

source

pub fn write_primary<D: Read + Write + Seek>( &self, file: &mut D, lb_size: LogicalBlockSize ) -> Result<usize>

Write the primary header.

With a CRC32 set to zero this will set the crc32 after writing the header out.

source

pub fn write_backup<D: Read + Write + Seek>( &self, file: &mut D, lb_size: LogicalBlockSize ) -> Result<usize>

Write the backup header.

With a CRC32 set to zero this will set the crc32 after writing the header out.

Trait Implementations§

source§

impl Clone for Header

source§

fn clone(&self) -> Header

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Header

source§

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

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

impl Display for Header

source§

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

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

impl PartialEq for Header

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Header

source§

impl StructuralPartialEq for Header

Auto Trait Implementations§

§

impl Freeze for Header

§

impl RefUnwindSafe for Header

§

impl Send for Header

§

impl Sync for Header

§

impl Unpin for Header

§

impl UnwindSafe for Header

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> 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,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.