shio/ext/
futures.rs

1use futures::Future;
2
3pub trait Future2 {
4    type Item;
5    type Error;
6}
7
8/// A type alias for Box<Item = T, Error = E>
9pub type BoxFuture<T, E> = Box<Future<Item = T, Error = E>>;
10
11pub trait FutureExt: Future {
12    fn into_box(self) -> BoxFuture<Self::Item, Self::Error>
13    where
14        Self: Sized + 'static,
15    {
16        Box::new(self)
17    }
18}
19
20impl<F: Future> FutureExt for F {}