Struct multiboot2_header::RelocatableHeaderTag
source · #[repr(C)]pub struct RelocatableHeaderTag { /* private fields */ }Expand description
This tag indicates that the image is relocatable.
Implementations§
source§impl RelocatableHeaderTag
impl RelocatableHeaderTag
sourcepub const fn new(
flags: HeaderTagFlag,
min_addr: u32,
max_addr: u32,
align: u32,
preference: RelocatableHeaderTagPreference
) -> Self
pub const fn new( flags: HeaderTagFlag, min_addr: u32, max_addr: u32, align: u32, preference: RelocatableHeaderTagPreference ) -> Self
Examples found in repository?
examples/minimal.rs (lines 12-18)
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);
}pub const fn typ(&self) -> HeaderTagType
pub const fn flags(&self) -> HeaderTagFlag
pub const fn size(&self) -> u32
pub const fn min_addr(&self) -> u32
pub const fn max_addr(&self) -> u32
pub const fn align(&self) -> u32
pub const fn preference(&self) -> RelocatableHeaderTagPreference
Trait Implementations§
source§impl Clone for RelocatableHeaderTag
impl Clone for RelocatableHeaderTag
source§fn clone(&self) -> RelocatableHeaderTag
fn clone(&self) -> RelocatableHeaderTag
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 Debug for RelocatableHeaderTag
impl Debug for RelocatableHeaderTag
source§impl Hash for RelocatableHeaderTag
impl Hash for RelocatableHeaderTag
source§impl Ord for RelocatableHeaderTag
impl Ord for RelocatableHeaderTag
source§fn cmp(&self, other: &RelocatableHeaderTag) -> Ordering
fn cmp(&self, other: &RelocatableHeaderTag) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for RelocatableHeaderTag
impl PartialEq for RelocatableHeaderTag
source§fn eq(&self, other: &RelocatableHeaderTag) -> bool
fn eq(&self, other: &RelocatableHeaderTag) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd for RelocatableHeaderTag
impl PartialOrd for RelocatableHeaderTag
source§fn partial_cmp(&self, other: &RelocatableHeaderTag) -> Option<Ordering>
fn partial_cmp(&self, other: &RelocatableHeaderTag) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for RelocatableHeaderTag
impl Eq for RelocatableHeaderTag
impl StructuralPartialEq for RelocatableHeaderTag
Auto Trait Implementations§
impl Freeze for RelocatableHeaderTag
impl RefUnwindSafe for RelocatableHeaderTag
impl Send for RelocatableHeaderTag
impl Sync for RelocatableHeaderTag
impl Unpin for RelocatableHeaderTag
impl UnwindSafe for RelocatableHeaderTag
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