Trait AsyncFn

1.85.0 ยท Source
pub trait AsyncFn<Args>: AsyncFnMut<Args>
where Args: Tuple,
{ // Required method extern "rust-call" fn async_call( &self, args: Args, ) -> Self::CallRefFuture<'_>; }
Expand description

An async-aware version of the Fn trait.

All async fn and functions returning futures implement this trait.

Required Methodsยง

Source

extern "rust-call" fn async_call( &self, args: Args, ) -> Self::CallRefFuture<'_>

๐Ÿ”ฌThis is a nightly-only experimental API. (async_fn_traits)

Call the AsyncFn, returning a future which may borrow from the called closure.

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementorsยง

1.85.0 ยท Sourceยง

impl<A, F> AsyncFn<A> for &F
where A: Tuple, F: AsyncFn<A> + ?Sized,

1.85.0 ยท Sourceยง

impl<Args, F, A> AsyncFn<Args> for Box<F, A>
where Args: Tuple, F: AsyncFn<Args> + ?Sized, A: Allocator,