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