Skip to content

Commit 012f6b6

Browse files
committed
add IntoFuture
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
1 parent 155256c commit 012f6b6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/future/into_future.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use crate::future::Future;
2+
3+
/// Convert a type into a `Future`.
4+
pub trait IntoFuture {
5+
/// The type of value produced on completion.
6+
type Output;
7+
8+
/// Which kind of future are we turning this into?
9+
type Future: Future<Output = Self::Output>;
10+
11+
/// Create a future from a value
12+
fn into_future(self) -> Self::Future;
13+
}

src/future/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ use cfg_if::cfg_if;
5353
pub use pending::pending;
5454
pub use poll_fn::poll_fn;
5555
pub use ready::ready;
56+
pub use into_future::IntoFuture;
5657

58+
mod into_future;
5759
mod pending;
5860
mod poll_fn;
5961
mod ready;

0 commit comments

Comments
 (0)