Skip to content

firma_futures_util

Stable async callback bounds with a nameable concrete future.

[AsyncFuncOnce], [AsyncFuncMut], and [AsyncFunc] expose the future as [AsyncFuncOnce::Fut], so consumers can require Fut: Send without boxing or accessing unstable associated types on the standard async callable traits. The future is not required to be [Send] unless the consumer requests it.

Each trait takes one argument type: use () for no inputs and a tuple for multiple inputs. Higher-ranked argument bounds can select a different future type for each borrow lifetime.

Reusable callbacks must also implement ordinary [FnMut] or [Fn]. These traits do not cover lending async closures whose futures borrow captured closure state. Such closures can still be consumed once with [AsyncFuncOnce].

3 traits