Struct rusttype::Bytes [] [src]

pub struct Bytes<'a>(pub Cow<'a, [u8]>);

A newtype wrapper for Cow<[u8]> that can be targetted by From and Into. This is intended to be used for providing convenient APIs that can accept Vec<u8>s or &[u8]s or other types that can be read as [u8]s (feel free to provide your own From implementations).

Trait Implementations

impl From<Box<[u8]>> for Bytes<'static>
[src]

fn from(b: Box<[u8]>) -> Bytes<'static>

Performs the conversion.

impl From<Vec<u8>> for Bytes<'static>
[src]

fn from(v: Vec<u8>) -> Bytes<'static>

Performs the conversion.

impl<'a> From<Cow<'a, [u8]>> for Bytes<'a>
[src]

fn from(c: Cow<'a, [u8]>) -> Bytes<'a>

Performs the conversion.

impl<'a> From<&'a [u8]> for Bytes<'a>
[src]

fn from(s: &'a [u8]) -> Bytes<'a>

Performs the conversion.