1use futures::Future;
4
5pub type BoxFuture<Item, Error> = Box<Future<Item = Item, Error = Error>>;
7
8pub trait FutureExt: Future + Sized {
10 fn into_box(self) -> Box<Future<Item = Self::Item, Error = Self::Error>>;
12}
13
14impl<T: Future + 'static> FutureExt for T {
15 fn into_box(self) -> Box<Future<Item = Self::Item, Error = Self::Error>> {
16 Box::new(self)
17 }
18}
19
20pub mod boxfuture {
21 use futures::future;
22 use futures::future::FutureResult;
23
24 pub fn ok<T, E>(t: T) -> Box<FutureResult<T, E>> {
26 Box::new(future::ok(t))
27 }
28}