rs_kv2spacetimedb/
compose.rs1pub fn compose_err_mut<F, G, T, U, V, E>(mut f: F, mut g: G) -> impl FnMut(T) -> Result<V, E>
2where
3 F: FnMut(T) -> Result<U, E>,
4 G: FnMut(U) -> Result<V, E>,
5{
6 move |t: T| {
7 let u: U = f(t)?;
8 g(u)
9 }
10}
11
12pub fn compose_err<F, G, T, U, V, E>(f: F, g: G) -> impl Fn(T) -> Result<V, E>
13where
14 F: Fn(T) -> Result<U, E>,
15 G: Fn(U) -> Result<V, E>,
16{
17 move |t: T| {
18 let u: U = f(t)?;
19 g(u)
20 }
21}
22
23pub fn compose<F, G, T, U, V>(f: F, g: G) -> impl Fn(T) -> V
24where
25 F: Fn(T) -> U,
26 G: Fn(U) -> V,
27{
28 move |t: T| {
29 let u: U = f(t);
30 g(u)
31 }
32}