Struct bytes::str::Bytes
[−]
[src]
pub struct Bytes { /* 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 (container[index]
) operation
impl Debug for Bytes
[src]
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]
impl Send for Bytes
[src]
impl Sync for Bytes
[src]
impl<'a> Source for &'a Bytes
[src]
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 !=
.