File tree Expand file tree Collapse file tree 4 files changed +47
-1
lines changed Expand file tree Collapse file tree 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::{
1010} ;
1111
1212mod future;
13+ mod into_future;
1314mod pending;
1415mod ready;
1516
1617#[ stable( feature = "futures_api" , since = "1.36.0" ) ]
1718pub use self :: future:: Future ;
1819
20+ #[ unstable( feature = "into_future" , issue = "67644" ) ]
21+ pub use into_future:: IntoFuture ;
22+
1923#[ unstable( feature = "future_readiness_fns" , issue = "70921" ) ]
2024pub use pending:: { pending, Pending } ;
2125#[ unstable( feature = "future_readiness_fns" , issue = "70921" ) ]
Original file line number Diff line number Diff line change 22
33#[ doc( inline) ]
44#[ 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 266266#![ feature( external_doc) ]
267267#![ feature( fn_traits) ]
268268#![ feature( format_args_nl) ]
269+ #![ feature( future_readiness_fns) ]
270+ #![ feature( gen_future) ]
269271#![ feature( generator_trait) ]
270272#![ feature( global_asm) ]
271273#![ feature( hash_raw_entry) ]
272274#![ feature( hashmap_internals) ]
273275#![ feature( int_error_internals) ]
274276#![ feature( int_error_matching) ]
277+ #![ feature( into_future) ]
275278#![ feature( integer_atomics) ]
276279#![ feature( lang_items) ]
277280#![ feature( libc) ]
You can’t perform that action at this time.
0 commit comments