multiboot2_header/
lib.rs

1//! Convenient and safe parsing of Multiboot2 Header structures and the
2//! contained header tags. Usable in `no_std` environments, such as a
3//! bootloader. An optional builder feature also allows the construction of
4//! the corresponding structures.
5//!
6//! ## Design
7//!
8//! For every Multiboot2 header structure, there is an ABI-compatible rusty type.
9//! This enables a zero-copying parsing design while also enabling the creation
10//! of these structures via convenient constructors on the corresponding types.
11//!
12//! # Example: Parsing a Header
13//!
14//! ```no_run
15//! use multiboot2_header::Multiboot2Header;
16//!
17//! let ptr = 0x1337_0000 as *const u8 /* use real ptr here */;
18//! let mb2_hdr = unsafe { Multiboot2Header::load(ptr.cast()) }.unwrap();
19//! for _tag in mb2_hdr.iter() {
20//!     //
21//! }
22//! ```
23//!
24//! ## MSRV
25//!
26//! The MSRV is 1.85.0 stable.
27
28#![no_std]
29// --- BEGIN STYLE CHECKS ---
30#![deny(
31    clippy::all,
32    clippy::cargo,
33    clippy::nursery,
34    clippy::must_use_candidate,
35    // clippy::restriction,
36    // clippy::pedantic
37)]
38// now allow a few rules which are denied by the above statement
39// --> They are either ridiculous, not necessary, or we can't fix them.
40#![allow(clippy::multiple_crate_versions)]
41#![deny(missing_docs)]
42#![deny(missing_debug_implementations)]
43#![deny(rustdoc::all)]
44// --- END STYLE CHECKS ---
45
46#[cfg(feature = "builder")]
47extern crate alloc;
48
49#[cfg_attr(test, macro_use)]
50#[cfg(test)]
51extern crate std;
52
53/// Iterator over the tags of a Multiboot2 boot information.
54pub type TagIter<'a> = multiboot2_common::TagIter<'a, HeaderTagHeader>;
55
56/// A generic version of all boot information tags.
57#[cfg(test)]
58pub type GenericHeaderTag = multiboot2_common::DynSizedStructure<HeaderTagHeader>;
59
60mod address;
61mod console;
62mod end;
63mod entry_address;
64mod entry_efi_32;
65mod entry_efi_64;
66mod framebuffer;
67mod header;
68mod information_request;
69mod module_align;
70mod relocatable;
71mod tags;
72mod uefi_bs;
73
74#[cfg(feature = "builder")]
75mod builder;
76
77pub use multiboot2_common::{DynSizedStructure, MaybeDynSized, Tag};
78
79pub use self::address::*;
80pub use self::console::*;
81pub use self::end::*;
82pub use self::entry_address::*;
83pub use self::entry_efi_32::*;
84pub use self::entry_efi_64::*;
85pub use self::framebuffer::*;
86pub use self::header::*;
87pub use self::information_request::*;
88pub use self::module_align::*;
89pub use self::relocatable::*;
90pub use self::tags::*;
91pub use self::uefi_bs::*;
92#[cfg(feature = "builder")]
93pub use builder::Builder;
94
95/// Re-export of [`multiboot2::TagType`] from `multiboot2`-crate.
96pub use multiboot2::{TagType as MbiTagType, TagTypeId as MbiTagTypeId};