ps_promise/methods/
new.rs1use std::future::Future;
2
3use crate::{Promise, PromiseRejection};
4
5impl<T, E> Promise<T, E>
6where
7 T: Unpin,
8 E: PromiseRejection,
9{
10 pub fn new<F>(future: F) -> Self
11 where
12 F: Future<Output = Result<T, E>> + Send + 'static,
13 {
14 Self::Pending(Box::pin(future))
15 }
16}