瀏覽代碼

multiboot2: unify command_line() -> cmdline()

Philipp Schuster 1 年之前
父節點
當前提交
7d1abed742
共有 4 個文件被更改,包括 8 次插入10 次删除
  1. 1 0
      multiboot2/Changelog.md
  2. 1 4
      multiboot2/src/builder/information.rs
  3. 4 4
      multiboot2/src/command_line.rs
  4. 2 2
      multiboot2/src/lib.rs

+ 1 - 0
multiboot2/Changelog.md

@@ -17,6 +17,7 @@
 - **BREAKING** Renamed `EFISdt32` to `EFISdt32Tag`
 - **BREAKING** Renamed `EFISdt64` to `EFISdt64Tag`
 - **BREAKING** Renamed `EFIBootServicesNotExited` to `EFIBootServicesNotExitedTag`
+- **BREAKING** Renamed `CommandLineTag::command_line` renamed to `CommandLineTag::cmdline`
 - **\[Might be\] BREAKING** Added `TagTrait` trait which enables to use DSTs as multiboot2 tags. This is
   mostly relevant for the command line tag, the modules tag, and the bootloader
   name tag. However, this might also be relevant for users of custom multiboot2

+ 1 - 4
multiboot2/src/builder/information.rs

@@ -335,10 +335,7 @@ mod tests {
             mb2i.basic_memory_info_tag().unwrap().memory_upper(),
             7 * 1024
         );
-        assert_eq!(
-            mb2i.command_line_tag().unwrap().command_line().unwrap(),
-            "test"
-        );
+        assert_eq!(mb2i.command_line_tag().unwrap().cmdline().unwrap(), "test");
         let mut modules = mb2i.module_tags();
         let module_1 = modules.next().unwrap();
         assert_eq!(module_1.start_address(), 0);

+ 4 - 4
multiboot2/src/command_line.rs

@@ -52,11 +52,11 @@ impl CommandLineTag {
     /// ```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();
+    ///     let command_line = tag.cmdline();
     ///     assert_eq!(Ok("/bootarg"), command_line);
     /// }
     /// ```
-    pub fn command_line(&self) -> Result<&str, str::Utf8Error> {
+    pub fn cmdline(&self) -> Result<&str, str::Utf8Error> {
         Tag::get_dst_str_slice(&self.cmdline)
     }
 }
@@ -66,7 +66,7 @@ impl Debug for CommandLineTag {
         f.debug_struct("CommandLineTag")
             .field("typ", &{ self.typ })
             .field("size", &{ self.size })
-            .field("cmdline", &self.command_line())
+            .field("cmdline", &self.cmdline())
             .finish()
     }
 }
@@ -115,7 +115,7 @@ mod tests {
         let tag = unsafe { &*tag.as_ptr().cast::<Tag>() };
         let tag = tag.cast_tag::<CommandLineTag>();
         assert_eq!({ tag.typ }, TagType::Cmdline);
-        assert_eq!(tag.command_line().expect("must be valid UTF-8"), MSG);
+        assert_eq!(tag.cmdline().expect("must be valid UTF-8"), MSG);
     }
 
     /// Test to generate a tag from a given string.

+ 2 - 2
multiboot2/src/lib.rs

@@ -497,7 +497,7 @@ impl fmt::Debug for BootInformation<'_> {
                 "command_line",
                 &self
                     .command_line_tag()
-                    .and_then(|x| x.command_line().ok())
+                    .and_then(|x| x.cmdline().ok())
                     .unwrap_or(""),
             )
             .field("memory_areas", &self.memory_map_tag())
@@ -1392,7 +1392,7 @@ mod tests {
             "",
             bi.command_line_tag()
                 .expect("tag must present")
-                .command_line()
+                .cmdline()
                 .expect("must be valid utf-8")
         );