pub trait SeekBuffered {
    // Required methods
    fn ensure_seekback_buffer(&mut self, len: usize);
    fn unread_buffer_len(&self) -> usize;
    fn read_buffer_len(&self) -> usize;
    fn seek_buffered(&mut self, pos: u64) -> u64;
    fn seek_buffered_rel(&mut self, delta: isize) -> u64;

    // Provided method
    fn seek_buffered_rev(&mut self, delta: usize) { ... }
}
Expand description

SeekBuffered provides methods to seek within the buffered portion of a stream.

Required Methods§

source

fn ensure_seekback_buffer(&mut self, len: usize)

Ensures that len bytes will be available for backwards seeking if len bytes have been previously read.

source

fn unread_buffer_len(&self) -> usize

Get the number of bytes buffered but not yet read.

Note: This is the maximum number of bytes that can be seeked forwards within the buffer.

source

fn read_buffer_len(&self) -> usize

Gets the number of bytes buffered and read.

Note: This is the maximum number of bytes that can be seeked backwards within the buffer.

source

fn seek_buffered(&mut self, pos: u64) -> u64

Seek within the buffered data to an absolute position in the stream. Returns the position seeked to.

source

fn seek_buffered_rel(&mut self, delta: isize) -> u64

Seek within the buffered data relative to the current position in the stream. Returns the position seeked to.

The range of delta is clamped to the inclusive range defined by -read_buffer_len()..=unread_buffer_len().

Provided Methods§

source

fn seek_buffered_rev(&mut self, delta: usize)

Seek backwards within the buffered data.

This function is identical to SeekBuffered::seek_buffered_rel when a negative delta is provided.

Implementations on Foreign Types§

source§

impl<'b, S: SeekBuffered> SeekBuffered for &'b mut S

Implementors§