Add AsyncFn family of traits
This commit is contained in:
parent
71696e516d
commit
0e6f7c6c7c
5 changed files with 134 additions and 1 deletions
16
tests/ui/async-await/async-fn/simple.rs
Normal file
16
tests/ui/async-await/async-fn/simple.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// edition: 2021
|
||||
// check-pass
|
||||
|
||||
#![feature(async_fn_traits)]
|
||||
|
||||
use std::ops::AsyncFn;
|
||||
|
||||
async fn foo() {}
|
||||
|
||||
async fn call_asyncly(f: impl AsyncFn(i32) -> i32) -> i32 {
|
||||
f.async_call((1i32,)).await
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let fut = call_asyncly(|x| async move { x + 1 });
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue