| use crate::io::AsyncWrite; |
| use pin_project_lite::pin_project; |
| use std::marker::PhantomPinned; |
| use std::task::{Context, Poll}; |
| /// A future used to shutdown an I/O object. |
| /// Created by the [`AsyncWriteExt::shutdown`][shutdown] function. |
| /// [shutdown]: crate::io::AsyncWriteExt::shutdown |
| #[must_use = "futures do nothing unless you `.await` or poll them"] |
| pub struct Shutdown<'a, A: ?Sized> { |
| // Make this future `!Unpin` for compatibility with async trait methods. |
| /// Creates a future which will shutdown an I/O object. |
| pub(super) fn shutdown<A>(a: &mut A) -> Shutdown<'_, A> |
| A: AsyncWrite + Unpin + ?Sized, |
| impl<A> Future for Shutdown<'_, A> |
| A: AsyncWrite + Unpin + ?Sized, |
| type Output = io::Result<()>; |
| fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { |
| Pin::new(me.a).poll_shutdown(cx) |