Hi, just wanted to ask if borrow with higher order async fns (from there arguments) is not correct never at all, or there might be some solutions in the future. Please check the example.
use std::future::Future;
async fn f(data: &Vec<String>) {
}
async fn start<Fut>(prm: fn(&Vec<String>) -> Fut)
where
Fut: Future<Output = ()>
{
let data = vec![];
prm(&data).await;
}
fn main() {
start(f);
}
(Playground)
Errors:
Compiling playground v0.0.1 (/playground)
error[E0308]: mismatched types
--> src/main.rs:16:11
|
16 | start(f);
| ^ expected concrete lifetime, found bound lifetime parameter
|
= note: expected type `for<'r> fn(&'r std::vec::Vec<std::string::String>) -> _`
found type `for<'_> fn(&std::vec::Vec<std::string::String>) -> impl std::future::Future {f}`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: could not compile `playground`.
To learn more, run the command again with --verbose.
Hi, just wanted to ask if borrow with higher order async fns (from there arguments) is not correct never at all, or there might be some solutions in the future. Please check the example.
(Playground)
Errors: