bevy_asset::io

Trait AsyncSeekForward

source
pub trait AsyncSeekForward {
    // Required method
    fn poll_seek_forward(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        offset: u64,
    ) -> Poll<Result<u64>>;
}
Expand description

Asynchronously advances the cursor position by a specified number of bytes.

This trait is a simplified version of the futures_io::AsyncSeek trait, providing support exclusively for the futures_io::SeekFrom::Current variant. It allows for relative seeking from the current cursor position.

Required Methods§

source

fn poll_seek_forward( self: Pin<&mut Self>, cx: &mut Context<'_>, offset: u64, ) -> Poll<Result<u64>>

Attempts to asynchronously seek forward by a specified number of bytes from the current cursor position.

Seeking beyond the end of the stream is allowed and the behavior for this case is defined by the implementation. The new position, relative to the beginning of the stream, should be returned upon successful completion of the seek operation.

If the seek operation completes successfully, the new position relative to the beginning of the stream should be returned.

§Implementation

Implementations of this trait should handle Poll::Pending correctly, converting std::io::ErrorKind::WouldBlock errors into Poll::Pending to indicate that the operation is not yet complete and should be retried, and either internally retry or convert std::io::ErrorKind::Interrupted into another error kind.

Implementations on Foreign Types§

source§

impl<T: ?Sized + AsyncSeekForward + Unpin> AsyncSeekForward for Box<T>

source§

fn poll_seek_forward( self: Pin<&mut Self>, cx: &mut Context<'_>, offset: u64, ) -> Poll<Result<u64>>

Implementors§