mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
16 lines
299 B
Rust
16 lines
299 B
Rust
//@ aux-build:block-on.rs
|
|
//@ edition:2021
|
|
//@ build-pass
|
|
|
|
extern crate block_on;
|
|
|
|
fn wrapper(f: impl Fn(String)) -> impl AsyncFn(String) {
|
|
async move |s| f(s)
|
|
}
|
|
|
|
fn main() {
|
|
block_on::block_on(async {
|
|
wrapper(|who| println!("Hello, {who}!"))(String::from("world")).await;
|
|
});
|
|
}
|