Struct bytes::Bytes [] [src]

pub struct Bytes {
    // some fields omitted
}

A specialized ByteStr box.

Methods

impl Bytes
[src]

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
[src]

type Buf = Box<Buf + 'static>

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

Returns a read-only Buf for accessing the byte contents of the ByteStr. Read more

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

Returns a new Bytes value representing the concatenation of self with the given Bytes. Read more

fn len(&self) -> usize

Returns the number of bytes in the ByteStr

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

Returns a new ByteStr value containing the byte range between begin (inclusive) and end (exclusive) Read more

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

Divides the value into two Bytes at the given index. Read more

fn is_empty(&self) -> bool

Returns true if the length of the ByteStr is 0

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

Returns a new ByteStr value containing the byte range starting from begin (inclusive) to the end of the byte str. Read more

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

Returns a new ByteStr value containing the byte range from the start up to end (exclusive). Read more

impl ToBytes for Bytes
[src]

fn to_bytes(self) -> Bytes

Consumes the value and returns a Bytes instance containing identical bytes Read more

impl Index<usize> for Bytes
[src]

type Output = u8

The returned type after indexing

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

The method for the indexing (Foo[Bar]) operation

impl Debug for Bytes
[src]

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

Formats the value using the given formatter.

impl Clone for Bytes
[src]

fn clone(&self) -> Bytes

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Drop for Bytes
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more

impl Send for Bytes
[src]

impl Sync for Bytes
[src]

impl<'a> Source for &'a Bytes
[src]

type Error = BufError

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

impl<B: ByteStr> PartialEq<B> for Bytes
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

impl Eq for Bytes
[src]