io: add AsyncSeekExt::stream_position (#3650)

This commit is contained in:
Taiki Endo 2021-03-27 12:28:51 +09:00 committed by GitHub
parent 9a3603fa75
commit a257a3a2b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,6 +66,17 @@ cfg_io_util! {
{
seek(self, pos)
}
/// Creates a future which will return the current seek position from the
/// start of the stream.
///
/// This is equivalent to `self.seek(SeekFrom::Current(0))`.
fn stream_position(&mut self) -> Seek<'_, Self>
where
Self: Unpin,
{
self.seek(SeekFrom::Current(0))
}
}
}