Function buf_trait::as_buf

source ·
pub const unsafe fn as_buf<B: ?Sized + Buf>(bytes: &[u8]) -> &B
Expand description

Converts a byte slice to a reference to a Buf.

Unlike Buf::from_bytes(), this function is const.

Safety

See Buf::from_bytes().