nrustlang·Rust Langbynjaard Async Closures MVP: Call for Testing! | Inside Rust Bloghttps://blog.rust-lang.org/inside-rust/2024/08/09/async-closures-call-for-testing.htmlOpen linkView original on lemmy.world3Comments1
nnjaard lemmy.worldThere's this example: // Instead of writing: fn higher_ranked<F>(callback: F) where F: Fn(&Arg) -> Pin<Box<dyn Future<Output = ()> + '_>> { todo!() } // Write this: fn higher_ranked<F: async Fn(&Arg)> { todo!() } // Or this: fn higher_ranked<F: AsyncFn(&Arg)> { todo!() } But it seems that's in error and it should have the parameter: fn higher_ranked<F: async Fn(&Arg)>(callback: F){ todo!() } 1
There's this example:
But it seems that's in error and it should have the parameter: