Trait AsyncCallback

Source
pub trait AsyncCallback<'a, A1: 'a, A2: 'a, T: 'a>:
    'static
    + Send
    + Sync
    + Fn(&'a mut A1, &'a A2) -> Self::Fut {
    type Fut: Future<Output = T> + Send;
}
Expand description

Helper trait for async functions.

This is needed because with a simple impl Fn() -> Fut, we can’t express a variadic lifetime bound from the future to the function parameter. impl AsyncFn would allow this, but that doesn’t allow to express a Send bound on the future.

Required Associated Types§

Source

type Fut: Future<Output = T> + Send

Implementors§

Source§

impl<'a, A1: 'a, A2: 'a, T: 'a, Out, F> AsyncCallback<'a, A1, A2, T> for F
where Out: Send + Future<Output = T>, F: 'static + Sync + Send + Fn(&'a mut A1, &'a A2) -> Out,

Source§

type Fut = Out