lib.rs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //! Rust library with type definitions and parsing functions for Multiboot2
  2. //! headers, as well as a builder to build them at runtime. This library is
  3. //! `no_std` and can be used in bootloaders.
  4. //!
  5. //! # Example: Parsing a Header
  6. //!
  7. //! ```no_run
  8. //! use multiboot2_header::Multiboot2Header;
  9. //!
  10. //! let ptr = 0x1337_0000 as *const u8 /* use real ptr here */;
  11. //! let mb2_hdr = unsafe { Multiboot2Header::load(ptr.cast()) }.unwrap();
  12. //! for _tag in mb2_hdr.iter() {
  13. //! //
  14. //! }
  15. //! ```
  16. //!
  17. //! ## MSRV
  18. //!
  19. //! The MSRV is 1.70.0 stable.
  20. #![no_std]
  21. #![cfg_attr(feature = "unstable", feature(error_in_core))]
  22. // --- BEGIN STYLE CHECKS ---
  23. #![deny(
  24. clippy::all,
  25. clippy::cargo,
  26. clippy::nursery,
  27. clippy::must_use_candidate,
  28. // clippy::restriction,
  29. // clippy::pedantic
  30. )]
  31. // now allow a few rules which are denied by the above statement
  32. // --> They are either ridiculous, not necessary, or we can't fix them.
  33. #![allow(clippy::multiple_crate_versions)]
  34. #![deny(missing_docs)]
  35. #![deny(missing_debug_implementations)]
  36. #![deny(rustdoc::all)]
  37. // --- END STYLE CHECKS ---
  38. #[cfg(feature = "builder")]
  39. extern crate alloc;
  40. #[cfg_attr(test, macro_use)]
  41. #[cfg(test)]
  42. extern crate std;
  43. /// Iterator over the tags of a Multiboot2 boot information.
  44. pub type TagIter<'a> = multiboot2_common::TagIter<'a, HeaderTagHeader>;
  45. /// A generic version of all boot information tags.
  46. #[cfg(test)]
  47. pub type GenericHeaderTag = multiboot2_common::DynSizedStructure<HeaderTagHeader>;
  48. mod address;
  49. mod console;
  50. mod end;
  51. mod entry_address;
  52. mod entry_efi_32;
  53. mod entry_efi_64;
  54. mod framebuffer;
  55. mod header;
  56. mod information_request;
  57. mod module_align;
  58. mod relocatable;
  59. mod tags;
  60. mod uefi_bs;
  61. #[cfg(feature = "builder")]
  62. mod builder;
  63. pub use multiboot2_common::{DynSizedStructure, MaybeDynSized, Tag};
  64. pub use self::address::*;
  65. pub use self::console::*;
  66. pub use self::end::*;
  67. pub use self::entry_address::*;
  68. pub use self::entry_efi_32::*;
  69. pub use self::entry_efi_64::*;
  70. pub use self::framebuffer::*;
  71. pub use self::header::*;
  72. pub use self::information_request::*;
  73. pub use self::module_align::*;
  74. pub use self::relocatable::*;
  75. pub use self::tags::*;
  76. pub use self::uefi_bs::*;
  77. #[cfg(feature = "builder")]
  78. pub use builder::Builder;
  79. /// Re-export of [`multiboot2::TagType`] from `multiboot2`-crate.
  80. pub use multiboot2::{TagType as MbiTagType, TagTypeId as MbiTagTypeId};