pub struct InformationRequestHeaderTagBuilder { /* private fields */ }Expand description
Helper to build the dynamically sized InformationRequestHeaderTag
at runtime. The information request tag has a dedicated builder because this way one
can dynamically attach several requests to it. Otherwise, the number of requested tags
must be known at compile time.
Implementations§
source§impl InformationRequestHeaderTagBuilder
impl InformationRequestHeaderTagBuilder
sourcepub const fn new(flag: HeaderTagFlag) -> Self
pub const fn new(flag: HeaderTagFlag) -> Self
New builder.
Examples found in repository?
examples/minimal.rs (line 20)
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
fn main() {
// We create a Multiboot2 header during runtime here. A practical example is that your
// program gets the header from a file and parses it afterwards.
let mb2_hdr_bytes = HeaderBuilder::new(HeaderTagISA::I386)
.relocatable_tag(RelocatableHeaderTag::new(
HeaderTagFlag::Required,
0x1337,
0xdeadbeef,
4096,
RelocatableHeaderTagPreference::None,
))
.information_request_tag(
InformationRequestHeaderTagBuilder::new(HeaderTagFlag::Required)
.add_irs(&[MbiTagType::Cmdline, MbiTagType::BootLoaderName]),
)
.build();
// Cast bytes in vector to Multiboot2 information structure
let mb2_hdr = unsafe { Multiboot2Header::load(mb2_hdr_bytes.as_ptr().cast()) };
println!("{:#?}", mb2_hdr);
}sourcepub fn expected_len(&self) -> usize
pub fn expected_len(&self) -> usize
Returns the expected length of the information request tag,
when the build-method gets called.
sourcepub fn add_ir(self, tag: MbiTagType) -> Self
pub fn add_ir(self, tag: MbiTagType) -> Self
Adds an MbiTagType to the information request.
sourcepub fn add_irs(self, tags: &[MbiTagType]) -> Self
pub fn add_irs(self, tags: &[MbiTagType]) -> Self
Adds multiple MbiTagType to the information request.
Examples found in repository?
examples/minimal.rs (line 21)
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
fn main() {
// We create a Multiboot2 header during runtime here. A practical example is that your
// program gets the header from a file and parses it afterwards.
let mb2_hdr_bytes = HeaderBuilder::new(HeaderTagISA::I386)
.relocatable_tag(RelocatableHeaderTag::new(
HeaderTagFlag::Required,
0x1337,
0xdeadbeef,
4096,
RelocatableHeaderTagPreference::None,
))
.information_request_tag(
InformationRequestHeaderTagBuilder::new(HeaderTagFlag::Required)
.add_irs(&[MbiTagType::Cmdline, MbiTagType::BootLoaderName]),
)
.build();
// Cast bytes in vector to Multiboot2 information structure
let mb2_hdr = unsafe { Multiboot2Header::load(mb2_hdr_bytes.as_ptr().cast()) };
println!("{:#?}", mb2_hdr);
}Trait Implementations§
source§impl Clone for InformationRequestHeaderTagBuilder
impl Clone for InformationRequestHeaderTagBuilder
source§fn clone(&self) -> InformationRequestHeaderTagBuilder
fn clone(&self) -> InformationRequestHeaderTagBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl PartialEq for InformationRequestHeaderTagBuilder
impl PartialEq for InformationRequestHeaderTagBuilder
source§fn eq(&self, other: &InformationRequestHeaderTagBuilder) -> bool
fn eq(&self, other: &InformationRequestHeaderTagBuilder) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl Eq for InformationRequestHeaderTagBuilder
impl StructuralEq for InformationRequestHeaderTagBuilder
impl StructuralPartialEq for InformationRequestHeaderTagBuilder
Auto Trait Implementations§
impl RefUnwindSafe for InformationRequestHeaderTagBuilder
impl Send for InformationRequestHeaderTagBuilder
impl Sync for InformationRequestHeaderTagBuilder
impl Unpin for InformationRequestHeaderTagBuilder
impl UnwindSafe for InformationRequestHeaderTagBuilder
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