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