Struct mbr_nostd::MasterBootRecord
source · pub struct MasterBootRecord { /* private fields */ }
Expand description
A struct representing an MBR partition table.
Implementations
sourceimpl 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:
BufferWrongSizeError
ifbytes.len()
is less than 512InvalidMBRSuffix
if the final 2 bytes inbytes
are not[0x55, 0xaa]
UnsupportedPartitionError
if 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:
BufferWrongSizeError
ifbuffer.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
sourceimpl PartitionTable for MasterBootRecord
impl PartitionTable for MasterBootRecord
sourcefn partition_table_entries(&self) -> &[PartitionTableEntry]
fn partition_table_entries(&self) -> &[PartitionTableEntry]
The entries in this table.
Auto Trait Implementations
impl RefUnwindSafe for MasterBootRecord
impl Send for MasterBootRecord
impl Sync for MasterBootRecord
impl Unpin for MasterBootRecord
impl UnwindSafe for MasterBootRecord
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more