Skip to main content

FragmentedBuffer

Trait FragmentedBuffer 

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FragmentedBuffer for !

Source§

fn len(&self) -> usize

Source§

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

Source§

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

Source§

fn len(&self) -> usize

Source§

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

Source§

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

Implementors§