pub trait AsyncClosure<Arg> {
    type Output;
    type Future: Future<Output = Self::Output>;

    // Required method
    fn call(&self, arg: Arg) -> Self::Future;
}
Expand description

Same as std::ops::Fn trait but for async output.

It is necessary in the the HRTB bounds for async fn’s with reference parameters because it allows the output future to be bound to the parameter lifetime. F: for<'a> AsyncClosure<(&'a u8,) Output=u8>

Required Associated Types§

source

type Output

source

type Future: Future<Output = Self::Output>

Required Methods§

source

fn call(&self, arg: Arg) -> Self::Future

Implementors§

source§

impl<Func, Fut> AsyncClosure<()> for Func
where Func: Fn() -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut

source§

impl<Func, Fut, A> AsyncClosure<(A,)> for Func
where Func: Fn(A) -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut

source§

impl<Func, Fut, A, B> AsyncClosure<(A, B)> for Func
where Func: Fn(A, B) -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut

source§

impl<Func, Fut, A, B, C> AsyncClosure<(A, B, C)> for Func
where Func: Fn(A, B, C) -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut

source§

impl<Func, Fut, A, B, C, D> AsyncClosure<(A, B, C, D)> for Func
where Func: Fn(A, B, C, D) -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut

source§

impl<Func, Fut, A, B, C, D, E> AsyncClosure<(A, B, C, D, E)> for Func
where Func: Fn(A, B, C, D, E) -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut

source§

impl<Func, Fut, A, B, C, D, E, F> AsyncClosure<(A, B, C, D, E, F)> for Func
where Func: Fn(A, B, C, D, E, F) -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut

source§

impl<Func, Fut, A, B, C, D, E, F, G> AsyncClosure<(A, B, C, D, E, F, G)> for Func
where Func: Fn(A, B, C, D, E, F, G) -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut

source§

impl<Func, Fut, A, B, C, D, E, F, G, H> AsyncClosure<(A, B, C, D, E, F, G, H)> for Func
where Func: Fn(A, B, C, D, E, F, G, H) -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut

source§

impl<Func, Fut, A, B, C, D, E, F, G, H, I> AsyncClosure<(A, B, C, D, E, F, G, H, I)> for Func
where Func: Fn(A, B, C, D, E, F, G, H, I) -> Fut, Fut: Future,

§

type Output = <Fut as Future>::Output

§

type Future = Fut