Skip to content

Commit 1cf09f3

Browse files
committed
kernel_cmdline: impl Display for utf8::Cmdline
We already impl AsRef<str> but this just makes it more convenient to render the command line for users. Signed-off-by: John Eckersberg <[email protected]>
1 parent 02b06c0 commit 1cf09f3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/kernel_cmdline/src/utf8.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ impl<'a> AsRef<str> for Cmdline<'a> {
134134
}
135135
}
136136

137+
impl<'a> std::fmt::Display for Cmdline<'a> {
138+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
139+
let as_str: &str = self.as_ref();
140+
write!(f, "{as_str}")
141+
}
142+
}
143+
137144
/// A single kernel command line parameter key
138145
///
139146
/// Handles quoted values and treats dashes and underscores in keys as equivalent.

0 commit comments

Comments
 (0)