Skip to main content

BufferWriter

Trait BufferWriter 

Source
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§

Source

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

Source

fn remaining_capacity(&self) -> usize

Return the number of bytes that can be written without an error

Provided Methods§

Source

fn has_remaining_capacity(&self) -> bool

Returns true if the writer has remaining capacity to write to

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<'a, T: AsMut<[u8]> + AsRef<[u8]>> BufferWriter for Write<'a, T>