Trait ReadBuffer

Source
pub trait ReadBuffer<T>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I);
    fn remaining_capacity(&self) -> usize;
    fn move_from(&mut self, input: &mut dyn WriteBuffer<T>, count: usize);
}
Available on crate features runtime and component-model and component-model-async only.
Expand description

Trait representing a buffer which may be used to read from a StreamReader.

See also crate::component::Instance::stream.

Required Methods§

Source

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Move the specified items into this buffer.

Source

fn remaining_capacity(&self) -> usize

Number of items which may be read before this buffer is full.

Source

fn move_from(&mut self, input: &mut dyn WriteBuffer<T>, count: usize)

Move (i.e. take ownership of) the specified items into this buffer.

This method will drain count items from the input provided and move ownership into this buffer.

§Panics

This method will panic if count is larger than self.remaining_capacity() or if it’s larger than input.remaining().

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: Send + Sync + 'static> ReadBuffer<T> for Option<T>

Source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Source§

fn remaining_capacity(&self) -> usize

Source§

fn move_from(&mut self, input: &mut dyn WriteBuffer<T>, count: usize)

Source§

impl<T: Send + Sync + 'static> ReadBuffer<T> for Vec<T>

Source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Source§

fn remaining_capacity(&self) -> usize

Source§

fn move_from(&mut self, input: &mut dyn WriteBuffer<T>, count: usize)

Implementors§