Skip to main content

Buffer

Trait Buffer 

Source
pub unsafe trait Buffer: AsRef<[u8]> {
    // Required methods
    fn from_bytes(bytes: &[u8]) -> Self;
    fn from_vec(bytes: Vec<u8>) -> Self;
}
Expand description

Buffer type.

§Safety

The AsRef<[u8]> implementation must return the bytes provided using the from_bytes and from_vec constructor functions.

Required Methods§

Source

fn from_bytes(bytes: &[u8]) -> Self

Source

fn from_vec(bytes: Vec<u8>) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Buffer for Vec<u8>

Source§

fn from_bytes(bytes: &[u8]) -> Vec<u8>

Source§

fn from_vec(bytes: Vec<u8>) -> Vec<u8>

Source§

impl<A> Buffer for SmallVec<A>
where A: Array<Item = u8>,

Source§

fn from_vec(bytes: Vec<u8>) -> SmallVec<A>

Source§

fn from_bytes(bytes: &[u8]) -> SmallVec<A>

Implementors§