]> git.lizzy.rs Git - rust.git/blob - src/libcore/future/into_future.rs
Rollup merge of #73771 - alexcrichton:ignore-unstable, r=estebank,GuillaumeGomez
[rust.git] / src / libcore / future / into_future.rs
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 }