News for hackers. Stuff that matters.
Re:Common Rust Lifetime Misconceptions by wtetzner on Wednesday May 27, 2020 @11:39AM (#23324928)
I could see that. It was a little confusing to me too. At first I couldn't figure out why anyone would want into_iter(). Didn't realize it returned owned objects.

Now that I think about it, how does into_iter() work on a Vec? Is it just copying the data out of the Vec anyway? Because the data in a Vec is allocated on the heap, so how can you get an owned object that isn't just a reference (pointer) to the heap memory without copying?

If that's the case, is the only benefit of into_iter() that you don't have to explicitly deref and copy the items?

There are no comments on this comment yet.