An async version of the Seek trait:
pub trait Seek {
fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
fn rewind(&mut self) -> Result<()> { ... }
fn stream_len(&mut self) -> Result<u64> { ... }
fn stream_position(&mut self) -> Result<u64> { ... }
}
Prior art
pub trait AsyncSeek {
fn poll_seek(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
pos: SeekFrom
) -> Poll<Result<u64>>;
}
pub trait AsyncSeek {
fn start_seek(self: Pin<&mut Self>, position: SeekFrom) -> Result<()>;
fn poll_complete(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<u64>>;
}
Extends futures-rs with a convenience seek function
fn seek(&mut self, pos: SeekFrom) -> ImplFuture<Result<u64>>
where
Self: Unpin,
{ ... }
Misc
An async version of the Seek trait:
Prior art
futures-rs
Tokio
async-std
Extends futures-rs with a convenience
seekfunctionMisc