pub trait BufferWriter: DerefMut<Target = [u8]> {
// Required methods
fn commit(&self, n: usize) -> Result<(), BufferError>;
fn remaining_capacity(&self) -> usize;
// Provided method
fn has_remaining_capacity(&self) -> bool { ... }
}
Expand description
A Writer to write to a Buffer
as it is a writeable slice
Required Methods§
Sourcefn commit(&self, n: usize) -> Result<(), BufferError>
fn commit(&self, n: usize) -> Result<(), BufferError>
After writing th bytes to self
the user must tell teh buffer how many bytes have bee written.
This increases the write_position of the buffer by n
Sourcefn remaining_capacity(&self) -> usize
fn remaining_capacity(&self) -> usize
Return the number of bytes that can be written without an error
Provided Methods§
Sourcefn has_remaining_capacity(&self) -> bool
fn has_remaining_capacity(&self) -> bool
Returns true
if the writer has remaining capacity to write to