Trait salvo::http::BodyChunk[][src]

pub trait BodyChunk {
    fn split_into(self, idx: usize) -> (Self, Self);
fn as_slice(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
; fn slice<R>(&self, range: R) -> &<R as SliceIndex<[u8]>>::Output
    where
        R: SliceIndex<[u8]>
, { ... }
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
fn into_vec(self) -> Vec<u8, Global> { ... } }

Required methods

fn split_into(self, idx: usize) -> (Self, Self)[src]

Expand description

Split the chunk at idx, returning (self[..idx], self[idx..]).

fn as_slice(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Expand description

Get the slice representing the data of this chunk.

Loading content...

Provided methods

fn slice<R>(&self, range: R) -> &<R as SliceIndex<[u8]>>::Output where
    R: SliceIndex<[u8]>, 
[src]

Expand description

Slice the bytes in self according to the given range.

fn len(&self) -> usize[src]

Expand description

Equivalent to self.as_slice().len()

fn is_empty(&self) -> bool[src]

Expand description

Equivalent to self.as_slice().is_empty()

fn into_vec(self) -> Vec<u8, Global>[src]

Expand description

Equivalent to self.as_slice().to_owned()

Implementors are welcome to override this if they can provide a cheaper conversion.

Loading content...

Implementations on Foreign Types

impl BodyChunk for Vec<u8, Global>[src]

pub fn split_into(self, idx: usize) -> (Vec<u8, Global>, Vec<u8, Global>)[src]

pub fn as_slice(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn into_vec(self) -> Vec<u8, Global>[src]

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

pub fn split_into(self, idx: usize) -> (Cow<'a, [u8]>, Cow<'a, [u8]>)[src]

pub fn as_slice(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn into_vec(self) -> Vec<u8, Global>[src]

impl<'a> BodyChunk for &'a [u8][src]

pub fn split_into(self, idx: usize) -> (&'a [u8], &'a [u8])[src]

pub fn as_slice(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Loading content...

Implementors

impl BodyChunk for Bytes[src]

pub fn split_into(self, idx: usize) -> (Bytes, Bytes)[src]

pub fn as_slice(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Loading content...