Seek bytes asynchronously.
This trait is analogous to the
std::io::Seek trait, but integrates
with the asynchronous task system. In particular, the
Seek::seek, will automatically queue the current task
for wakeup and return if data is not yet available, rather than blocking
the calling thread.
Attempt to 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
Seeking to a negative offset is considered an error.
This function may not return errors of kind
Interrupted. Implementations must convert
Poll::Pending and either internally retry or convert
Interrupted into another error kind.
Seek to an offset, in bytes, in the underlying reader.
The position used for seeking with
SeekFrom::Current(_) is the
position the underlying reader would be at if the
BufReader had no
Seeking always discards the internal buffer, even if the seek position
would otherwise fall within it. This guarantees that calling
.into_inner() immediately after a seek yields the underlying reader
at the same position.
AsyncSeek for more details.
Note: In the edge case where you're seeking with
n minus the internal buffer length overflows an
seeks will be performed instead of one. If the second seek returns
Err, the underlying reader will be left at the same position it would
have if you called
impl<T> AsyncSeek for AllowStdIo<T> where[src]