Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Implement the rewind method as part of the AsyncSeekExt trait.
  • Loading branch information
tvercruyssen committed Sep 13, 2021
commit c73e5679cfe8dc24156f69cd0765bc3b815b5e0d
10 changes: 10 additions & 0 deletions tokio/src/io/util/async_seek_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ cfg_io_util! {
seek(self, pos)
}

/// Creates a future which will rewind to the beginning of the stream.
///
/// This is convenience method, equivalent to to `self.seek(SeekFrom::Start(0))`.
fn rewind(&mut self) -> Seek<'_, Self>
where
Self: Unpin,
{
self.seek(SeekFrom::Start(0))
}

/// Creates a future which will return the current seek position from the
/// start of the stream.
///
Expand Down