1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use futures::Future;
use std::fmt::Debug;
use std::{boxed::Box, pin::Pin};
pub fn combine_param<R: Sized + 'static, T: Sized + 'static, E: Sized + 'static + Debug>(
    t: T,
) -> impl FnOnce(Result<R, E>) -> Pin<Box<dyn Future<Output = Result<(R, T), E>>>> {
    |r: Result<R, E>| Box::pin(async { Ok((r.unwrap(), t)) })
}
pub fn combine_flat_param<R: Sized + 'static, T: Sized + 'static, E: Sized + 'static + Debug>(
    t: T,
) -> impl FnOnce(R) -> Pin<Box<dyn Future<Output = Result<(R, T), E>>>> {
    |r: R| Box::pin(async { Ok((r, t)) })
}