pub trait FragmentedBuffer {
    // Required methods
    fn len(&self) -> usize;
    fn with_bytes<R, F>(&self, f: F) -> R
       where F: for<'a, 'b> FnOnce(FragmentedBytes<'a, 'b>) -> R;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn to_flattened_vec(&self) -> Vec<u8> { ... }
}
Expand description

A buffer that may be fragmented in multiple parts which are discontiguous in memory.

Required Methods§

source

fn len(&self) -> usize

Gets the total length, in bytes, of this FragmentedBuffer.

source

fn with_bytes<R, F>(&self, f: F) -> R
where F: for<'a, 'b> FnOnce(FragmentedBytes<'a, 'b>) -> R,

Invokes a callback on a view into this buffer’s contents as FragmentedBytes.

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if this FragmentedBuffer is empty.

source

fn to_flattened_vec(&self) -> Vec<u8>

Returns a flattened version of this buffer, copying its contents into a Vec.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FragmentedBuffer for Infallible

source§

fn len(&self) -> usize

source§

fn with_bytes<R, F>(&self, _f: F) -> R
where F: for<'a, 'b> FnOnce(FragmentedBytes<'a, 'b>) -> R,

source§

impl<'a> FragmentedBuffer for &'a [u8]

source§

fn len(&self) -> usize

source§

fn with_bytes<R, F>(&self, f: F) -> R
where F: for<'macro_a, 'macro_b> FnOnce(FragmentedBytes<'macro_a, 'macro_b>) -> R,

source§

fn to_flattened_vec(&self) -> Vec<u8>

source§

impl<'a> FragmentedBuffer for &'a mut [u8]

source§

fn len(&self) -> usize

source§

fn with_bytes<R, F>(&self, f: F) -> R
where F: for<'macro_a, 'macro_b> FnOnce(FragmentedBytes<'macro_a, 'macro_b>) -> R,

source§

fn to_flattened_vec(&self) -> Vec<u8>

Implementors§