Hey guys, I'm going further with my studies,
I could implement:
- An async function that receives an async callback which consumes it arguments
- An async function that receives an synchronous callback which receives a reference (borrowing)
I couldn't implement:
- Async function that receives an async callback which borrow it's arguments
I'm using a recursive walkdir as case of study, it receives a path to start, and a callback, it calls the callback for every file it founds, and recurse it in folders that it find .. is a good exercise and became complex fast
Here is the working code (synchronous callback)
And here is the not working code (async callback)
I tried that
'b lifetime parameter to say "Hey,
&DirEntry will live as long as my returned
Future, but it seems that this is not the case since, it won't compile, I now I'm stuck, again
Is what I'm trying to do, possible?
How can I express that "I have a callback that receives a reference and return a future and that the reference lives lesser than my outer function, but enough for the callback"?
In other words, how can I express lifetimes for
Fn async callbacks parameters?