@@ -13,6 +13,7 @@ use crate::task::{Context, Poll};
13
13
#[ unstable( feature = "async_iterator" , issue = "79024" ) ]
14
14
#[ must_use = "async iterators do nothing unless polled" ]
15
15
#[ doc( alias = "Stream" ) ]
16
+ #[ cfg_attr( not( bootstrap) , lang = "async_iterator" ) ]
16
17
pub trait AsyncIterator {
17
18
/// The type of items yielded by the async iterator.
18
19
type Item ;
@@ -109,3 +110,27 @@ where
109
110
( * * self ) . size_hint ( )
110
111
}
111
112
}
113
+
114
+ #[ unstable( feature = "async_gen_internals" , issue = "none" ) ]
115
+ impl < T > Poll < Option < T > > {
116
+ /// A helper function for internal desugaring -- produces `Ready(Some(t))`,
117
+ /// which corresponds to the async iterator yielding a value.
118
+ #[ unstable( feature = "async_gen_internals" , issue = "none" ) ]
119
+ #[ cfg_attr( not( bootstrap) , lang = "AsyncGenReady" ) ]
120
+ pub fn async_gen_ready ( t : T ) -> Self {
121
+ Poll :: Ready ( Some ( t) )
122
+ }
123
+
124
+ /// A helper constant for internal desugaring -- produces `Pending`,
125
+ /// which corresponds to the async iterator pending on an `.await`.
126
+ #[ unstable( feature = "async_gen_internals" , issue = "none" ) ]
127
+ #[ cfg_attr( not( bootstrap) , lang = "AsyncGenPending" ) ]
128
+ // FIXME(gen_blocks): This probably could be deduplicated.
129
+ pub const PENDING : Self = Poll :: Pending ;
130
+
131
+ /// A helper constant for internal desugaring -- produces `Ready(None)`,
132
+ /// which corresponds to the async iterator finishing its iteration.
133
+ #[ unstable( feature = "async_gen_internals" , issue = "none" ) ]
134
+ #[ cfg_attr( not( bootstrap) , lang = "AsyncGenFinished" ) ]
135
+ pub const FINISHED : Self = Poll :: Ready ( None ) ;
136
+ }
0 commit comments