Having trouble with a lifetime for a reference passed with the value itself
I solved my previous problems with implementing an enum that supports polling different types of async results, but now I'm running into a lifetime problem.
My thinking is as follows -
(L78) I hold on to the enum values in the remaining futures vec.
(L84-85) We get the values back from select_all in .2 minus the one that completed, and move that back into our remaining_futures variable. next is the value of the future that completed.
(L90) we match and move the value of a ReadDir to rd.
Calling next_entry will be a reference to rd, so we need to ensure that the ReadDir value is kept alive alongside the future, which we do in another field of the tuple.
In my head at least, I'm being careful to ensure that the value is kept alive to be referenced, but I'm really struggling to express that to the compiler (or I'm not understanding something).
Any help very welcome to help me understand what I'm missing here.
Thanks!
Posted Jun 5, 2021, 7:01 PM UTC