Struct multiboot2_header::Multiboot2Header
source · [−]#[repr(transparent)]pub struct Multiboot2Header<'a> { /* private fields */ }Expand description
Wrapper type around a pointer to the Multiboot2 header.
The Multiboot2 header is the Multiboot2BasicHeader followed
by all tags (see crate::tags::HeaderTagType).
Use this if you get a pointer to the header and just want
to parse it. If you want to construct the type by yourself,
please look at crate::builder::Multiboot2HeaderBuilder.
Implementations
sourceimpl<'a> Multiboot2Header<'a>
impl<'a> Multiboot2Header<'a>
sourcepub unsafe fn from_addr(addr: usize) -> Self
pub unsafe fn from_addr(addr: usize) -> Self
Public constructor for this type with various validations. It panics if the address is invalid. It panics rather than returning a result, because if this fails, it is a fatal, unrecoverable error anyways and a bug in your code.
Panics
Panics if one of the following conditions is true:
addris a null-pointeraddrisn’t 8-byte aligned- the magic value of the header is not present
- the checksum field is invalid
Safety
This function may produce undefined behaviour, if the provided addr is not a valid
Multiboot2 header pointer.
sourcepub const fn verify_checksum(&self) -> bool
pub const fn verify_checksum(&self) -> bool
Wrapper around Multiboot2BasicHeader::verify_checksum.
sourcepub const fn header_magic(&self) -> u32
pub const fn header_magic(&self) -> u32
Wrapper around Multiboot2BasicHeader::header_magic.
sourcepub const fn arch(&self) -> HeaderTagISA
pub const fn arch(&self) -> HeaderTagISA
Wrapper around Multiboot2BasicHeader::arch.
sourcepub const fn length(&self) -> u32
pub const fn length(&self) -> u32
Wrapper around Multiboot2BasicHeader::length.
sourcepub const fn checksum(&self) -> u32
pub const fn checksum(&self) -> u32
Wrapper around Multiboot2BasicHeader::checksum.
sourcepub fn iter(&self) -> Multiboot2HeaderTagIterⓘNotable traits for Multiboot2HeaderTagIterimpl Iterator for Multiboot2HeaderTagIter type Item = *const HeaderTag;
pub fn iter(&self) -> Multiboot2HeaderTagIterⓘNotable traits for Multiboot2HeaderTagIterimpl Iterator for Multiboot2HeaderTagIter type Item = *const HeaderTag;
Wrapper around Multiboot2BasicHeader::tag_iter.
sourcepub const fn calc_checksum(magic: u32, arch: HeaderTagISA, length: u32) -> u32
pub const fn calc_checksum(magic: u32, arch: HeaderTagISA, length: u32) -> u32
Wrapper around Multiboot2BasicHeader::calc_checksum.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Multiboot2Header<'a>
impl<'a> Send for Multiboot2Header<'a>
impl<'a> Sync for Multiboot2Header<'a>
impl<'a> Unpin for Multiboot2Header<'a>
impl<'a> UnwindSafe for Multiboot2Header<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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