File tree 4 files changed +47
-1
lines changed
4 files changed +47
-1
lines changed Original file line number Diff line number Diff line change
1
+ use crate :: future:: Future ;
2
+
3
+ /// Conversion into a `Future`.
4
+ #[ unstable( feature = "into_future" , issue = "67644" ) ]
5
+ pub trait IntoFuture {
6
+ /// The output that the future will produce on completion.
7
+ #[ unstable( feature = "into_future" , issue = "67644" ) ]
8
+ type Output ;
9
+
10
+ /// Which kind of future are we turning this into?
11
+ #[ unstable( feature = "into_future" , issue = "67644" ) ]
12
+ type Future : Future < Output = Self :: Output > ;
13
+
14
+ /// Creates a future from a value.
15
+ #[ unstable( feature = "into_future" , issue = "67644" ) ]
16
+ fn into_future ( self ) -> Self :: Future ;
17
+ }
18
+
19
+ #[ unstable( feature = "into_future" , issue = "67644" ) ]
20
+ impl < F : Future > IntoFuture for F {
21
+ type Output = F :: Output ;
22
+ type Future = F ;
23
+
24
+ fn into_future ( self ) -> Self :: Future {
25
+ self
26
+ }
27
+ }
Original file line number Diff line number Diff line change @@ -10,12 +10,16 @@ use crate::{
10
10
} ;
11
11
12
12
mod future;
13
+ mod into_future;
13
14
mod pending;
14
15
mod ready;
15
16
16
17
#[ stable( feature = "futures_api" , since = "1.36.0" ) ]
17
18
pub use self :: future:: Future ;
18
19
20
+ #[ unstable( feature = "into_future" , issue = "67644" ) ]
21
+ pub use into_future:: IntoFuture ;
22
+
19
23
#[ unstable( feature = "future_readiness_fns" , issue = "70921" ) ]
20
24
pub use pending:: { pending, Pending } ;
21
25
#[ unstable( feature = "future_readiness_fns" , issue = "70921" ) ]
Original file line number Diff line number Diff line change 2
2
3
3
#[ doc( inline) ]
4
4
#[ stable( feature = "futures_api" , since = "1.36.0" ) ]
5
- pub use core:: future:: * ;
5
+ pub use core:: future:: Future ;
6
+
7
+ #[ doc( inline) ]
8
+ #[ unstable( feature = "gen_future" , issue = "50547" ) ]
9
+ pub use core:: future:: { from_generator, get_context, ResumeTy } ;
10
+
11
+ #[ doc( inline) ]
12
+ #[ unstable( feature = "future_readiness_fns" , issue = "70921" ) ]
13
+ pub use core:: future:: { pending, ready, Pending , Ready } ;
14
+
15
+ #[ doc( inline) ]
16
+ #[ unstable( feature = "into_future" , issue = "67644" ) ]
17
+ pub use core:: future:: IntoFuture ;
Original file line number Diff line number Diff line change 266
266
#![ feature( external_doc) ]
267
267
#![ feature( fn_traits) ]
268
268
#![ feature( format_args_nl) ]
269
+ #![ feature( future_readiness_fns) ]
270
+ #![ feature( gen_future) ]
269
271
#![ feature( generator_trait) ]
270
272
#![ feature( global_asm) ]
271
273
#![ feature( hash_raw_entry) ]
272
274
#![ feature( hashmap_internals) ]
273
275
#![ feature( int_error_internals) ]
274
276
#![ feature( int_error_matching) ]
277
+ #![ feature( into_future) ]
275
278
#![ feature( integer_atomics) ]
276
279
#![ feature( lang_items) ]
277
280
#![ feature( libc) ]
You can’t perform that action at this time.
0 commit comments