Skip to main content

IntoBytes

Trait IntoBytes 

Source
pub trait IntoBytes: AsRef<[u8]> {
    // Required method
    fn into_bytes(self) -> Bytes;
}
Expand description

Converts borrowed or owned byte buffers into Bytes.

Owned buffers keep their allocation when possible. Borrowed buffers copy into a new Bytes value.

Required Methods§

Source

fn into_bytes(self) -> Bytes

Convert this buffer into owned bytes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoBytes for &Bytes

Source§

impl IntoBytes for &BytesMut

Source§

impl IntoBytes for &String

Source§

impl IntoBytes for &Vec<u8>

Source§

impl IntoBytes for &[u8]

Source§

impl IntoBytes for &str

Source§

impl IntoBytes for Bytes

Source§

impl IntoBytes for BytesMut

Source§

impl IntoBytes for String

Source§

impl IntoBytes for Vec<u8>

Source§

impl<const N: usize> IntoBytes for &[u8; N]

Implementors§