pub trait Seek {
// Required methods
fn seek<E>(&mut self, pos: SeekFrom) -> Result<(), Error<E>>;
fn rewind(&mut self);
fn stream_len(&self) -> u16;
fn stream_position(&self) -> u16;
fn remain(&self) -> u16;
}
Expand description
The Seek
trait provides a cursor which can be moved within a stream of
bytes.
This is used for navigating the socket buffers, and it is designed to be
similar to std::io::Seek
.
Required Methods§
sourcefn seek<E>(&mut self, pos: SeekFrom) -> Result<(), Error<E>>
fn seek<E>(&mut self, pos: SeekFrom) -> Result<(), Error<E>>
Seek to an offset, in bytes, within the socket buffer.
Seeking beyond the limits will result Error::UnexpectedEof
.
Limits
sourcefn rewind(&mut self)
fn rewind(&mut self)
Rewind to the beginning of the stream.
This is a convenience method, equivalent to seek(SeekFrom::Start(0))
.
sourcefn stream_len(&self) -> u16
fn stream_len(&self) -> u16
sourcefn stream_position(&self) -> u16
fn stream_position(&self) -> u16
Returns the current seek position from the start of the stream.
Object Safety§
This trait is not object safe.