pub trait AsyncFn<'a, A, B, T>: Copy + 'staticwhere
    A: 'a,
    B: 'a,{
    type Fut: Future<Output = T> + 'a;

    // Required method
    fn call(self, a: &'a A, b: &'a B) -> Self::Fut;
}
Expand description

Taken from Reddit. Enables taking an async function pointer which takes references as param https://www.reddit.com/r/rust/comments/jvqorj/hrtb_with_async_functions/

Required Associated Types§

source

type Fut: Future<Output = T> + 'a

Required Methods§

source

fn call(self, a: &'a A, b: &'a B) -> Self::Fut

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, A, B, Fut, F> AsyncFn<'a, A, B, <Fut as Future>::Output> for Fwhere A: 'a, B: 'a, Fut: Future + 'a, F: Fn(&'a A, &'a B) -> Fut + Copy + 'static,

§

type Fut = Fut