Trait axfs::api::Seek

source ·
pub trait Seek {
    // Required method
    fn seek(&mut self, pos: SeekFrom) -> Result<u64, AxError>;

    // Provided methods
    fn rewind(&mut self) -> Result<(), AxError> { ... }
    fn stream_position(&mut self) -> Result<u64, AxError> { ... }
}
Expand description

The Seek trait provides a cursor which can be moved within a stream of bytes.

Required Methods§

source

fn seek(&mut self, pos: SeekFrom) -> Result<u64, AxError>

Seek to an offset, in bytes, in a stream.

A seek beyond the end of a stream is allowed, but behavior is defined by the implementation.

If the seek operation completed successfully, this method returns the new position from the start of the stream. That position can be used later with SeekFrom::Start.

Provided Methods§

source

fn rewind(&mut self) -> Result<(), AxError>

Rewind to the beginning of a stream.

This is a convenience method, equivalent to seek(SeekFrom::Start(0)).

source

fn stream_position(&mut self) -> Result<u64, AxError>

Returns the current seek position from the start of the stream.

This is equivalent to self.seek(SeekFrom::Current(0)).

Implementors§