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
.