Basically, I want to implement a take_while, but by removing elements from a src vector and pushing them to a dst vector. I was able to solve this with this monstrosity:
It seems I annotated the predicate wrong, because passing &|i| i < &2 looks weird. I never had to do this for builtin calls that take a predicate.
I'm not happy with the fact that I can't modify src in place. My thinking here was that I should move src since after the call the original src is no longer valid. This happens because I internally create a VecDeque from it and return a new vector.
In general my code looks rather complicated. Given the vast options in the standard library, my guess is that I'm just missing something.
Does this refer to my question about the annotation of predicate? If yes, how would the "correct" annotation look like to make this behave like all the other callbacks?