use core::future::Future; use core::marker::PhantomData; use core::pin::Pin; use crate::task::{Context, Poll}; /// Never resolves to a value. /// /// # Examples /// /// ``` /// # async_std::task::block_on(async { /// # /// use std::time::Duration; /// /// use async_std::future; /// use async_std::io; /// /// let dur = Duration::from_secs(1); /// let fut = future::pending(); /// /// let res: io::Result<()> = io::timeout(dur, fut).await; /// assert!(res.is_err()); /// # /// # }) /// ``` pub fn pending() -> Pending { Pending { _marker: PhantomData, } } /// This future is constructed by the [`pending`] function. /// /// [`pending`]: fn.pending.html #[derive(Debug)] pub struct Pending { _marker: PhantomData, } impl Future for Pending { type Output = T; fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { Poll::Pending } }