1 use crate::fmt
::{self, Debug}
;
2 use crate::future
::Future
;
5 use crate::task
::{Context, Poll}
;
7 /// Creates a future which never resolves, representing a computation that never
10 /// This `struct` is created by [`pending()`]. See its
11 /// documentation for more.
12 #[stable(feature = "future_readiness_fns", since = "1.48.0")]
13 #[must_use = "futures do nothing unless you `.await` or poll them"]
14 pub struct Pending
<T
> {
15 _data
: marker
::PhantomData
<T
>,
18 /// Creates a future which never resolves, representing a computation that never
26 /// # async fn run() {
27 /// let future = future::pending();
28 /// let () = future.await;
32 #[stable(feature = "future_readiness_fns", since = "1.48.0")]
33 pub fn pending
<T
>() -> Pending
<T
> {
34 Pending { _data: marker::PhantomData }
37 #[stable(feature = "future_readiness_fns", since = "1.48.0")]
38 impl<T
> Future
for Pending
<T
> {
41 fn poll(self: Pin
<&mut Self>, _
: &mut Context
<'_
>) -> Poll
<T
> {
46 #[stable(feature = "future_readiness_fns", since = "1.48.0")]
47 impl<T
> Unpin
for Pending
<T
> {}
49 #[stable(feature = "future_readiness_fns", since = "1.48.0")]
50 impl<T
> Debug
for Pending
<T
> {
51 fn fmt(&self, f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
52 f
.debug_struct("Pending").finish()
56 #[stable(feature = "future_readiness_fns", since = "1.48.0")]
57 impl<T
> Clone
for Pending
<T
> {
58 fn clone(&self) -> Self {