async_std/io/seek/
seek.rs

1use std::pin::Pin;
2use std::future::Future;
3
4use crate::io::{self, Seek, SeekFrom};
5use crate::task::{Context, Poll};
6
7#[doc(hidden)]
8#[allow(missing_debug_implementations)]
9pub struct SeekFuture<'a, T: Unpin + ?Sized> {
10    pub(crate) seeker: &'a mut T,
11    pub(crate) pos: SeekFrom,
12}
13
14impl<T: Seek + Unpin + ?Sized> Future for SeekFuture<'_, T> {
15    type Output = io::Result<u64>;
16
17    fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
18        let pos = self.pos;
19        Pin::new(&mut *self.seeker).poll_seek(cx, pos)
20    }
21}