Y
Hacker News
new
|
ask
|
show
|
jobs
by
divingdragon
2087 days ago
You don't even need `std::mem::take`, you can just `drain` the `Vec`. This also allows the allocation to be reused, unlike your `mem::take` which ends up dropping the allocation.
`Vec::drain`:
https://doc.rust-lang.org/std/vec/struct.Vec.html#method.dra...