@@ -82,23 +82,25 @@ pub use stackfuture::StackFuture;
8282
8383/// Asynchronously advances the cursor position by a specified number of bytes.
8484///
85- /// This trait is similar to the `futures_io::AsyncSeek` trait, but it only supports
86- /// the `SeekFrom::Current` variant, allowing for relative seeking from the current cursor position.
85+ /// This trait is a simplified version of the [`futures_io::AsyncSeek`] trait, providing
86+ /// support exclusively for the [`futures_io::SeekFrom::Current`] variant. It allows for relative
87+ /// seeking from the current cursor position.
8788pub trait AsyncSeekForward {
88- /// Attempt to seek to an offset, in bytes, in a stream from the current cursor position.
89+ /// Attempts to asynchronously seek forward by a specified number of bytes from the current cursor position.
8990 ///
90- /// A seek beyond the end of a stream is allowed, but behavior is defined
91- /// by the implementation.
91+ /// Seeking beyond the end of the stream is allowed and the behavior for this case is defined by the implementation.
92+ /// The new position, relative to the beginning of the stream, should be returned upon successful completion
93+ /// of the seek operation.
9294 ///
93- /// If the seek operation completed successfully,
94- /// this method returns the new position from the start of the stream.
95+ /// If the seek operation completes successfully,
96+ /// the new position relative to the beginning of the stream should be returned .
9597 ///
9698 /// # Implementation
9799 ///
98- /// This function may not return errors of kind `WouldBlock` or
99- /// `Interrupted`. Implementations must convert `WouldBlock` into
100- /// `Poll::Pending` and either internally retry or convert
101- /// ` Interrupted` into another error kind.
100+ /// Implementations of this trait should handle [`Poll::Pending`] correctly, converting
101+ /// [`std::io::ErrorKind::WouldBlock`] errors into [`Poll::Pending`] to indicate that the operation is not
102+ /// yet complete and should be retried, and either internally retry or convert
103+ /// [`std::io::ErrorKind:: Interrupted`] into another error kind.
102104 fn poll_seek_forward (
103105 self : Pin < & mut Self > ,
104106 cx : & mut Context < ' _ > ,
@@ -119,7 +121,7 @@ impl<T: ?Sized + AsyncSeekForward + Unpin> AsyncSeekForward for Box<T> {
119121/// A type returned from [`AssetReader::read`], which is used to read the contents of a file
120122/// (or virtual file) corresponding to an asset.
121123///
122- /// This is essentially a trait alias for types implementing [`AsyncRead`] and [`AsyncForwardSeek `].
124+ /// This is essentially a trait alias for types implementing [`AsyncRead`] and [`AsyncSeekForward `].
123125/// The only reason a blanket implementation is not provided for applicable types is to allow
124126/// implementors to override the provided implementation of [`Reader::read_to_end`].
125127pub trait Reader : AsyncRead + AsyncSeekForward + Unpin + Send + Sync {
0 commit comments