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.75.0 stable.
27
28#![no_std]
29#![cfg_attr(feature = "unstable", feature(error_in_core))]
30// --- BEGIN STYLE CHECKS ---
31#![deny(
32    clippy::all,
33    clippy::cargo,
34    clippy::nursery,
35    clippy::must_use_candidate,
36    // clippy::restriction,
37    // clippy::pedantic
38)]
39// now allow a few rules which are denied by the above statement
40// --> They are either ridiculous, not necessary, or we can't fix them.
41#![allow(clippy::multiple_crate_versions)]
42#![deny(missing_docs)]
43#![deny(missing_debug_implementations)]
44#![deny(rustdoc::all)]
45// --- END STYLE CHECKS ---
46
47#[cfg(feature = "builder")]
48extern crate alloc;
49
50#[cfg_attr(test, macro_use)]
51#[cfg(test)]
52extern crate std;
53
54/// Iterator over the tags of a Multiboot2 boot information.
55pub type TagIter<'a> = multiboot2_common::TagIter<'a, HeaderTagHeader>;
56
57/// A generic version of all boot information tags.
58#[cfg(test)]
59pub type GenericHeaderTag = multiboot2_common::DynSizedStructure<HeaderTagHeader>;
60
61mod address;
62mod console;
63mod end;
64mod entry_address;
65mod entry_efi_32;
66mod entry_efi_64;
67mod framebuffer;
68mod header;
69mod information_request;
70mod module_align;
71mod relocatable;
72mod tags;
73mod uefi_bs;
74
75#[cfg(feature = "builder")]
76mod builder;
77
78pub use multiboot2_common::{DynSizedStructure, MaybeDynSized, Tag};
79
80pub use self::address::*;
81pub use self::console::*;
82pub use self::end::*;
83pub use self::entry_address::*;
84pub use self::entry_efi_32::*;
85pub use self::entry_efi_64::*;
86pub use self::framebuffer::*;
87pub use self::header::*;
88pub use self::information_request::*;
89pub use self::module_align::*;
90pub use self::relocatable::*;
91pub use self::tags::*;
92pub use self::uefi_bs::*;
93#[cfg(feature = "builder")]
94pub use builder::Builder;
95
96/// Re-export of [`multiboot2::TagType`] from `multiboot2`-crate.
97pub use multiboot2::{TagType as MbiTagType, TagTypeId as MbiTagTypeId};