Expand description
The Buf
trait.
This crate provides a trait for abstracting over buffer-like types, such
as str
and [u8]
. This is a much stronger property than, say,
implementing [AsRef<[u8]>
]. These are variable-length types that you might
want to store as a raw byte buffer and then transmute to and from &[u8]
.
This crate provides all the functionality necessary for doing so safely,
correctly, and in const
.
Traits§
- Buf
- A trait for abstracting over
str
,[u8]
, and other byte-string-like types.
Functions§
- as_buf⚠
- Converts a byte slice to a reference to a
Buf
. - as_
buf_ ⚠mut - Converts a mutable byte slice to a reference to a
Buf
. - as_
bytes - Converts a reference to a
Buf
into its underlying bytes. - as_
bytes_ mut - Converts a mutable reference to a
Buf
into its underlying bytes. - empty
- Creates a new empty
Buf
. - layout_
of - Computes the layout of
buf
.