io: clarify behavior of seeking when start_seek is not used (#7366)

This commit is contained in:
Alice Ryhl 2025-05-28 04:00:33 -07:00 committed by GitHub
parent 4380de9fe9
commit 328bd049f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,11 +34,17 @@ pub trait AsyncSeek {
/// Waits for a seek operation to complete.
///
/// 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 [`SeekFrom::Start`]. Repeatedly
/// calling this function without calling `start_seek` might return the
/// same result.
/// 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 [`SeekFrom::Start`].
///
/// The position returned by calling this method can only be relied on right
/// after `start_seek`. If you have changed the position by e.g. reading or
/// writing since calling `start_seek`, then it is unspecified whether the
/// returned position takes that position change into account. Similarly, if
/// `start_seek` has never been called, then it is unspecified whether
/// `poll_complete` returns the actual position or some other placeholder
/// value (such as 0).
///
/// # Errors
///