Skip to content

Commit 7d1abed

Browse files
committed
multiboot2: unify command_line() -> cmdline()
1 parent cb4a10b commit 7d1abed

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

multiboot2/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- **BREAKING** Renamed `EFISdt32` to `EFISdt32Tag`
1818
- **BREAKING** Renamed `EFISdt64` to `EFISdt64Tag`
1919
- **BREAKING** Renamed `EFIBootServicesNotExited` to `EFIBootServicesNotExitedTag`
20+
- **BREAKING** Renamed `CommandLineTag::command_line` renamed to `CommandLineTag::cmdline`
2021
- **\[Might be\] BREAKING** Added `TagTrait` trait which enables to use DSTs as multiboot2 tags. This is
2122
mostly relevant for the command line tag, the modules tag, and the bootloader
2223
name tag. However, this might also be relevant for users of custom multiboot2

multiboot2/src/builder/information.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,7 @@ mod tests {
335335
mb2i.basic_memory_info_tag().unwrap().memory_upper(),
336336
7 * 1024
337337
);
338-
assert_eq!(
339-
mb2i.command_line_tag().unwrap().command_line().unwrap(),
340-
"test"
341-
);
338+
assert_eq!(mb2i.command_line_tag().unwrap().cmdline().unwrap(), "test");
342339
let mut modules = mb2i.module_tags();
343340
let module_1 = modules.next().unwrap();
344341
assert_eq!(module_1.start_address(), 0);

multiboot2/src/command_line.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ impl CommandLineTag {
5252
/// ```rust,no_run
5353
/// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
5454
/// if let Some(tag) = boot_info.command_line_tag() {
55-
/// let command_line = tag.command_line();
55+
/// let command_line = tag.cmdline();
5656
/// assert_eq!(Ok("/bootarg"), command_line);
5757
/// }
5858
/// ```
59-
pub fn command_line(&self) -> Result<&str, str::Utf8Error> {
59+
pub fn cmdline(&self) -> Result<&str, str::Utf8Error> {
6060
Tag::get_dst_str_slice(&self.cmdline)
6161
}
6262
}
@@ -66,7 +66,7 @@ impl Debug for CommandLineTag {
6666
f.debug_struct("CommandLineTag")
6767
.field("typ", &{ self.typ })
6868
.field("size", &{ self.size })
69-
.field("cmdline", &self.command_line())
69+
.field("cmdline", &self.cmdline())
7070
.finish()
7171
}
7272
}
@@ -115,7 +115,7 @@ mod tests {
115115
let tag = unsafe { &*tag.as_ptr().cast::<Tag>() };
116116
let tag = tag.cast_tag::<CommandLineTag>();
117117
assert_eq!({ tag.typ }, TagType::Cmdline);
118-
assert_eq!(tag.command_line().expect("must be valid UTF-8"), MSG);
118+
assert_eq!(tag.cmdline().expect("must be valid UTF-8"), MSG);
119119
}
120120

121121
/// Test to generate a tag from a given string.

multiboot2/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ impl fmt::Debug for BootInformation<'_> {
497497
"command_line",
498498
&self
499499
.command_line_tag()
500-
.and_then(|x| x.command_line().ok())
500+
.and_then(|x| x.cmdline().ok())
501501
.unwrap_or(""),
502502
)
503503
.field("memory_areas", &self.memory_map_tag())
@@ -1392,7 +1392,7 @@ mod tests {
13921392
"",
13931393
bi.command_line_tag()
13941394
.expect("tag must present")
1395-
.command_line()
1395+
.cmdline()
13961396
.expect("must be valid utf-8")
13971397
);
13981398

0 commit comments

Comments
 (0)