Struct bytes::str::Bytes [] [src]

pub struct Bytes {
    // some fields omitted
}

A specialized ByteStr box.

Methods

impl Bytes

fn from_slice(bytes: &[u8]) -> Bytes

fn of<B: ByteStr>(bytes: B) -> Bytes

fn empty() -> Bytes

fn downcast_ref<'a, B: ByteStr>(&'a self) -> Option<&'a B>

If the underlying ByteStr is of type B, returns a reference to it otherwise None.

fn try_unwrap<B: ByteStr>(self) -> Result<B, Bytes>

If the underlying ByteStr is of type B, returns the unwraped value, otherwise, returns the original Bytes as Err.

Trait Implementations

impl ByteStr for Bytes

type Buf = Box<Buf + 'static>

fn buf(&self) -> Box<Buf + 'static>

fn concat<B: ByteStr>(&self, other: &B) -> Bytes

fn len(&self) -> usize

fn slice(&self, begin: usize, end: usize) -> Bytes

fn split_at(&self, mid: usize) -> (Bytes, Bytes)

fn is_empty(&self) -> bool

fn slice_from(&self, begin: usize) -> Bytes

fn slice_to(&self, end: usize) -> Bytes

impl ToBytes for Bytes

fn to_bytes(self) -> Bytes

impl Index<usize> for Bytes

type Output = u8

fn index(&self, index: usize) -> &u8

impl Debug for Bytes

fn fmt(&self, fmt: &mut Formatter) -> Result

impl Clone for Bytes

fn clone(&self) -> Bytes

1.0.0fn clone_from(&mut self, source: &Self)

impl Drop for Bytes

fn drop(&mut self)

impl Send for Bytes

impl Sync for Bytes

impl<'a> Source for &'a Bytes

type Error = BufError

fn fill<B: MutBuf>(self, dst: &mut B) -> Result<usize, BufError>

impl<B: ByteStr> PartialEq<B> for Bytes

fn eq(&self, other: &B) -> bool

fn ne(&self, other: &B) -> bool

impl Eq for Bytes