pillow_http/
futures_handler.rs

1use futures::Future;
2use std::pin::Pin;
3
4pub struct FuturesHandler {
5    func: Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>,
6}
7
8impl FuturesHandler {
9    pub async fn new(f: impl Future<Output = ()> + Send + Sync + 'static) -> FuturesHandler {
10        FuturesHandler { func: Box::pin(f) }
11    }
12
13    pub async fn run(&mut self) {
14        self.func.as_mut().await;
15    }
16}