Struct multiboot2::Tag
source · #[repr(C)]pub struct Tag {
pub typ: TagTypeId,
pub size: u32,
}
Expand description
Common base structure for all tags that can be passed via the Multiboot2 Information Structure (MBI) to a Multiboot2 payload/program/kernel.
Can be transformed to any other tag (sized or unsized/DST) via
Tag::cast_tag
.
Do not confuse them with the Multiboot2 header tags. They are something different.
Fields§
§typ: TagTypeId
§size: u32
Implementations§
source§impl Tag
impl Tag
sourcepub fn cast_tag<'a, T: TagTrait + ?Sized + 'a>(&'a self) -> &'a T
pub fn cast_tag<'a, T: TagTrait + ?Sized + 'a>(&'a self) -> &'a T
Casts the base tag to the specific tag type.
sourcepub fn get_dst_str_slice(bytes: &[u8]) -> Result<&str, Utf8Error>
pub fn get_dst_str_slice(bytes: &[u8]) -> Result<&str, Utf8Error>
Some multiboot2 tags are a DST as they end with a dynamically sized byte
slice. This function parses this slice as [str
] so that either a valid
UTF-8 Rust string slice without a terminating null byte or an error is
returned.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnwindSafe for Tag
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
source§impl<T> TagTrait for Twhere
T: Pointee<Metadata = ()>,
impl<T> TagTrait for Twhere
T: Pointee<Metadata = ()>,
source§fn dst_size(_: &Tag) -> <T as Pointee>::Metadata
fn dst_size(_: &Tag) -> <T as Pointee>::Metadata
Returns the amount of items in the dynamically sized portion of the
DST. Note that this is not the amount of bytes. So if the dynamically
sized portion is 16 bytes in size and each element is 4 bytes big, then
this function must return 4.
source§unsafe fn from_base_tag<'a>(tag: &Tag) -> &'a Self
unsafe fn from_base_tag<'a>(tag: &Tag) -> &'a Self
Creates a reference to a (dynamically sized) tag type in a safe way.
DST tags need to implement a proper
Self::dst_size
implementation. Read more