@njaard to Rust [email protected]English • 6 months agoAsync Closures MVP: Call for Testing! | Inside Rust Blogblog.rust-lang.orgexternal-linkmessage-square1arrow-up14arrow-down11cross-posted to: [email protected]
arrow-up13arrow-down1external-linkAsync Closures MVP: Call for Testing! | Inside Rust Blogblog.rust-lang.org@njaard to Rust [email protected]English • 6 months agomessage-square1cross-posted to: [email protected]
minus-square@njaardOPlinkEnglish1•6 months agoThere’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!() }
There’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!() }