Buffer

Trait Buffer 

Source
pub trait Buffer:
    Send
    + Sync
    + Debug {
    // Required methods
    fn open(
        &mut self,
        f: &mut dyn FnMut(&[u8]) -> Result<(), BufferError>,
    ) -> Result<(), BufferError>;
    fn open_mut(
        &mut self,
        f: &mut dyn FnMut(&mut [u8]) -> Result<(), BufferError>,
    ) -> Result<(), BufferError>;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Trait for buffer types that provide temporary access to their contents.

Required Methods§

Source

fn open( &mut self, f: &mut dyn FnMut(&[u8]) -> Result<(), BufferError>, ) -> Result<(), BufferError>

Opens the buffer for read-only access, executing the provided closure.

Source

fn open_mut( &mut self, f: &mut dyn FnMut(&mut [u8]) -> Result<(), BufferError>, ) -> Result<(), BufferError>

Opens the buffer for mutable access, executing the provided closure.

Source

fn len(&self) -> usize

Returns the length of the buffer in bytes.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the buffer has zero length.

Implementors§