File tree 4 files changed +39
-2
lines changed
4 files changed +39
-2
lines changed Original file line number Diff line number Diff line change
1
+ //! Futures and supporting APIs.
2
+ #![ unstable( feature = "async_await" , issue = "50547" ) ]
3
+
4
+ /// The Future trait.
5
+ #[ unstable( feature = "async_await" , issue = "50547" ) ]
6
+ pub trait Future { }
Original file line number Diff line number Diff line change @@ -191,10 +191,11 @@ pub mod ascii;
191
191
pub mod sync;
192
192
pub mod cell;
193
193
pub mod char;
194
- pub mod panic;
195
- pub mod panicking;
194
+ pub mod future;
196
195
pub mod iter;
197
196
pub mod option;
197
+ pub mod panic;
198
+ pub mod panicking;
198
199
pub mod raw;
199
200
pub mod result;
200
201
Original file line number Diff line number Diff line change @@ -97,3 +97,30 @@ pub struct TraitObject {
97
97
pub data : * mut ( ) ,
98
98
pub vtable : * mut ( ) ,
99
99
}
100
+
101
+ /// An adapter from a generator to a future.
102
+ ///
103
+ /// This is a permanently unstable API used by the compiler. You should not
104
+ /// depend on it.
105
+ #[ allow( missing_debug_implementations, dead_code) ]
106
+ #[ unstable( feature = "gen_future" , issue = "50547" ) ]
107
+ pub struct GenFuture < G , R > {
108
+ gen : G ,
109
+ marker : :: marker:: PhantomData < R > ,
110
+ }
111
+
112
+ /// Construct a future from a generator (used in lowering async functions).
113
+ ///
114
+ /// This is a permanently unstable API used by the compiler. You should not
115
+ /// depend on it.
116
+ #[ unstable( feature = "gen_future" , issue = "50547" ) ]
117
+ pub fn gen_future < G > ( gen : G ) -> GenFuture < G , G :: Return > where
118
+ G : :: ops:: Generator < Yield = ( ) >
119
+ {
120
+ GenFuture { gen, marker : :: marker:: PhantomData }
121
+ }
122
+
123
+ #[ unstable( feature = "gen_future" , issue = "50547" ) ]
124
+ impl < G > :: future:: Future for GenFuture < G , G :: Return > where
125
+ G : :: ops:: Generator < Yield = ( ) >
126
+ { }
Original file line number Diff line number Diff line change 242
242
#![ feature( array_error_internals) ]
243
243
#![ feature( ascii_ctype) ]
244
244
#![ feature( asm) ]
245
+ #![ feature( async_await) ]
245
246
#![ feature( attr_literals) ]
246
247
#![ feature( box_syntax) ]
247
248
#![ feature( cfg_target_has_atomic) ]
@@ -390,6 +391,8 @@ pub use core::cmp;
390
391
pub use core:: convert;
391
392
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
392
393
pub use core:: default;
394
+ #[ unstable( feature = "async_await" , issue = "50547" ) ]
395
+ pub use core:: future;
393
396
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
394
397
pub use core:: hash;
395
398
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
You can’t perform that action at this time.
0 commit comments