ps-promise 0.1.0-16

Promise-like owned futures
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::future::Future;

use crate::{Promise, WrappedPromiseRejection};

impl<T, E> Promise<T, WrappedPromiseRejection<E>>
where
    T: Unpin,
    E: Send + Unpin + 'static,
{
    pub fn wrap(future: impl Future<Output = Result<T, E>> + Send + 'static) -> Self {
        Self::new(async move { Ok(future.await?) })
    }
}