Trait ReadBuffer

pub trait ReadBuffer<T>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn extend<I>(&mut self, iter: I)
       where I: IntoIterator<Item = T>;
    fn remaining_capacity(&self) -> usize;
    fn move_from(
        &mut self,
        input: &mut (dyn WriteBuffer<T> + 'static),
        count: usize,
    );
}
Expand description

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

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

Required Methods§

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

Move the specified items into this buffer.

fn remaining_capacity(&self) -> usize

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

fn move_from( &mut self, input: &mut (dyn WriteBuffer<T> + 'static), 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§

§

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

§

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

§

fn remaining_capacity(&self) -> usize

§

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

§

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

§

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

§

fn remaining_capacity(&self) -> usize

§

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

Implementors§