embedded_io_async

Trait Seek

Source
pub trait Seek: ErrorType {
    // Required method
    async fn seek(&mut self, pos: SeekFrom) -> Result<u64, Self::Error>;

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

Async seek within streams.

This trait is the embedded-io-async equivalent of [std::io::Seek].

Required Methods§

Source

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

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

Provided Methods§

Source

async fn rewind(&mut self) -> Result<(), Self::Error>

Rewind to the beginning of a stream.

Source

async fn stream_position(&mut self) -> Result<u64, Self::Error>

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: ?Sized + Seek> Seek for &mut T

Source§

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

Implementors§