From: Gary Guo Date: Thu, 10 Nov 2022 16:41:26 +0000 (+0100) Subject: rust: str: add `BStr` type X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7c5977464681c2ec603efcac32a9432bcd355f12;p=linux.git rust: str: add `BStr` type Add the `BStr` type, which is a byte string without UTF-8 validity guarantee. It is simply an alias to `[u8]`, but has a more evident semantical meaning. Signed-off-by: Gary Guo [Reworded, adapted for upstream and applied latest changes] Signed-off-by: Miguel Ojeda --- diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index e45ff220ae50f..3aa1a0cb9bf87 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -4,6 +4,11 @@ use core::fmt; +/// Byte string without UTF-8 validity guarantee. +/// +/// `BStr` is simply an alias to `[u8]`, but has a more evident semantical meaning. +pub type BStr = [u8]; + /// Allows formatting of [`fmt::Arguments`] into a raw buffer. /// /// It does not fail if callers write past the end of the buffer so that they can calculate the