mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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 <gary@garyguo.net> [Reworded, adapted for upstream and applied latest changes] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
parent
feadd06287
commit
7c59774646
1 changed files with 5 additions and 0 deletions
|
@ -4,6 +4,11 @@
|
||||||
|
|
||||||
use core::fmt;
|
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.
|
/// 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
|
/// It does not fail if callers write past the end of the buffer so that they can calculate the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue