pub struct MasterBootRecord { /* private fields */ }Expand description
A struct representing an MBR partition table.
Implementations§
Source§impl MasterBootRecord
impl MasterBootRecord
Sourcepub fn from_bytes<T: AsRef<[u8]>>(
bytes: &T,
) -> Result<MasterBootRecord, MbrError>
pub fn from_bytes<T: AsRef<[u8]>>( bytes: &T, ) -> Result<MasterBootRecord, MbrError>
Parses the MBR table from a raw byte buffer.
Throws an error in the following cases:
BufferWrongSizeErrorifbytes.len()is less than 512InvalidMBRSuffixif the final 2 bytes inbytesare not[0x55, 0xaa]UnsupportedPartitionErrorif the MBR contains a tag that the crate does not recognize
Sourcepub fn serialize<T: AsMut<[u8]>>(
&self,
buffer: &mut T,
) -> Result<usize, MbrError>
pub fn serialize<T: AsMut<[u8]>>( &self, buffer: &mut T, ) -> Result<usize, MbrError>
Serializes this MBR partition table to a raw byte buffer. Throws an error in the following cases:
BufferWrongSizeErrorifbuffer.len()is less than 512
Note that it only affects the partition table itself, which only appears starting
from byte 446 of the MBR; no bytes before this are affected, even though it is
still necessary to pass a full 512 byte buffer.
Trait Implementations§
Source§impl PartitionTable for MasterBootRecord
impl PartitionTable for MasterBootRecord
Source§fn partition_table_entries(&self) -> &[PartitionTableEntry]
fn partition_table_entries(&self) -> &[PartitionTableEntry]
The entries in this table.
Auto Trait Implementations§
impl Freeze for MasterBootRecord
impl RefUnwindSafe for MasterBootRecord
impl Send for MasterBootRecord
impl Sync for MasterBootRecord
impl Unpin for MasterBootRecord
impl UnwindSafe for MasterBootRecord
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