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