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§
Sourcefn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Move the specified items into this buffer.
Sourcefn remaining_capacity(&self) -> usize
fn remaining_capacity(&self) -> usize
Number of items which may be read before this buffer is full.
Sourcefn move_from(&mut self, input: &mut dyn WriteBuffer<T>, count: usize)
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.