[][src]Struct mbrman::MBRHeader

pub struct MBRHeader {
    pub bootstrap_code: BootstrapCode440,
    pub disk_signature: [u8; 4],
    pub copy_protected: [u8; 2],
    pub partition_1: MBRPartitionEntry,
    pub partition_2: MBRPartitionEntry,
    pub partition_3: MBRPartitionEntry,
    pub partition_4: MBRPartitionEntry,
    pub boot_signature: Signature55AA,
}

An MBR partition table header

Fields

bootstrap_code: BootstrapCode440

Bootstrap code area

disk_signature: [u8; 4]

32-bit disk signature

copy_protected: [u8; 2]

[0x5a, 0x5a] if protected, [0x00, 0x00] if not

partition_1: MBRPartitionEntry

Partition 1

partition_2: MBRPartitionEntry

Partition 2

partition_3: MBRPartitionEntry

Partition 3

partition_4: MBRPartitionEntry

Partition 4

boot_signature: Signature55AA

Boot signature

Implementations

impl MBRHeader[src]

pub fn is_copy_protected(&self) -> Option<bool>[src]

Check if the partition table is copy-protected

pub fn get(&self, i: usize) -> Option<&MBRPartitionEntry>[src]

Get Some(&MBRPartitionEntry) if it exists, None otherwise.

Remarks

  • The partitions start at index 1
  • The first 4 partitions always exist
  • This function does not return logical partitions

pub fn get_mut(&mut self, i: usize) -> Option<&mut MBRPartitionEntry>[src]

Get Some(&mut MBRPartitionEntry) if it exists, None otherwise.

Remarks

  • The partitions start at index 1
  • The first 4 partitions always exist
  • This function does not return logical partitions

pub fn iter(&self) -> impl Iterator<Item = (usize, &MBRPartitionEntry)>[src]

Get an iterator over the primary partition entries and their index. The index always starts at 1.

pub fn iter_mut(
    &mut self
) -> impl Iterator<Item = (usize, &mut MBRPartitionEntry)>
[src]

Get a mutable iterator over the primary partition entries and their index. The index always starts at 1.

pub fn read_from<R: ?Sized>(reader: &mut R) -> Result<MBRHeader> where
    R: Read + Seek
[src]

Attempt to read a MBR header from a reader. This operation will seek at the correct location before trying to write to disk.

pub fn new(disk_signature: [u8; 4]) -> MBRHeader[src]

Make a new MBR header

pub fn write_into<W: ?Sized>(&self, writer: &mut W) -> Result<()> where
    W: Write + Seek
[src]

Write the MBR header into a writer. This operation will seek at the correct location before trying to write to disk.

Trait Implementations

impl Clone for MBRHeader[src]

impl Debug for MBRHeader[src]

impl<'de> Deserialize<'de> for MBRHeader[src]

impl Index<usize> for MBRHeader[src]

type Output = MBRPartitionEntry

The returned type after indexing.

impl IndexMut<usize> for MBRHeader[src]

impl PartialEq<MBRHeader> for MBRHeader[src]

impl Serialize for MBRHeader[src]

impl StructuralPartialEq for MBRHeader[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.