Browse Source

multiboot2: doc: fixes

Philipp Schuster 2 years ago
parent
commit
36c27d9fe9

+ 1 - 0
.editorconfig

@@ -9,6 +9,7 @@ insert_final_newline = true
 indent_style = space
 indent_size = 4
 trim_trailing_whitespace = true
+max_line_length = 80
 
 [*.yml]
 indent_size = 2

+ 0 - 2
Cargo.toml

@@ -1,7 +1,5 @@
 [workspace]
 members = [
-    # Multiboot2 Information Structure (MBI)
     "multiboot2",
-    # Multiboot2 headers
     "multiboot2-header",
 ]

+ 3 - 0
multiboot2/Changelog.md

@@ -1,5 +1,8 @@
 # CHANGELOG for crate `multiboot2`
 
+## 0.14.2
+- documentation fixes
+
 ## 0.14.1 (2023-03-09)
 - fixed the calculation of the last area of the memory map tag ([#119](https://github.com/rust-osdev/multiboot2/pull/119))
   (Previously, iterating the EFI Memory map resulted in a superfluous entry as it ran over the next tag)

+ 3 - 3
multiboot2/src/boot_loader_name.rs

@@ -21,10 +21,10 @@ impl BootLoaderNameTag {
     ///
     /// # Examples
     ///
-    /// ```ignore
+    /// ```rust,no_run
+    /// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
     /// if let Some(tag) = boot_info.boot_loader_name_tag() {
-    ///     let name = tag.name();
-    ///     assert_eq!("GRUB 2.02~beta3-5", name);
+    ///     assert_eq!(Ok("GRUB 2.02~beta3-5"), tag.name());
     /// }
     /// ```
     pub fn name(&self) -> Result<&str, Utf8Error> {

+ 3 - 2
multiboot2/src/command_line.rs

@@ -25,10 +25,11 @@ impl CommandLineTag {
     ///
     /// # Examples
     ///
-    /// ```ignore
+    /// ```rust,no_run
+    /// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
     /// if let Some(tag) = boot_info.command_line_tag() {
     ///     let command_line = tag.command_line();
-    ///     assert_eq!("/bootarg", command_line);
+    ///     assert_eq!(Ok("/bootarg"), command_line);
     /// }
     /// ```
     pub fn command_line(&self) -> Result<&str, str::Utf8Error> {

+ 2 - 1
multiboot2/src/elf_sections.rs

@@ -33,7 +33,8 @@ impl ElfSectionsTag {
     ///
     /// # Examples
     ///
-    /// ```ignore
+    /// ```rust,no_run
+    /// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
     /// if let Some(elf_tag) = boot_info.elf_sections_tag() {
     ///     let mut total = 0;
     ///     for section in elf_tag.sections() {

+ 6 - 6
multiboot2/src/lib.rs

@@ -6,8 +6,7 @@
 // https://github.com/rust-osdev/multiboot2/pull/92
 #![deny(clippy::all)]
 #![deny(rustdoc::all)]
-// Forcing this would be a little bit ridiculous, because it would require code examples for
-// each getter and each trivial trait implementation (like Debug).
+#![allow(rustdoc::private_doc_tests)]
 #![allow(rustdoc::missing_doc_code_examples)]
 // --- END STYLE CHECKS ---
 
@@ -88,7 +87,7 @@ pub const MULTIBOOT2_BOOTLOADER_MAGIC: u32 = 0x36d76289;
 
 /// Load the multiboot boot information struct from an address.
 ///
-/// This is the same as `load_with_offset` but the offset is omitted and set
+/// This is the same as [`load_with_offset`] but the offset is omitted and set
 /// to zero.
 ///
 /// ## Example
@@ -117,7 +116,7 @@ pub unsafe fn load(address: usize) -> Result<BootInformation, MbiLoadError> {
 ///
 /// ## Example
 ///
-/// ```ignore
+/// ```rust,no_run
 /// use multiboot2::load_with_offset;
 ///
 /// let ptr = 0xDEADBEEF as *const u32;
@@ -197,8 +196,9 @@ impl BootInformation {
     ///
     /// This is the same as doing:
     ///
-    /// ```ignore
-    /// let end_addr = boot_info.start_address() + boot_info.size();
+    /// ```rust,no_run
+    /// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
+    /// let end_addr = boot_info.start_address() + boot_info.total_size();
     /// ```
     pub fn end_address(&self) -> usize {
         self.start_address() + self.total_size()