Struct Subspace :: sus :: collections :: Drain
A draining iterator for Vec<T>
.
This struct is created by Vec::drain. See its documentation for more.
Panics
Drain can not support move-assignment because it holds a reference to a Vec from which it was created. Assigning can change the Vec to which it is pointing, but that Vec may have been created after the Drain object, since it was not created from that Vec. Then on destruction, Drain will point to a destroyed Vec:
auto v1 = Vec<i32>(1);
auto d1 = v1.drain(); // Points at v1.
auto v2 = Vec<i32>(1);
auto d2 = v2.drain(); // Points at v2.
d1 = sus::move(d2); // Points at v2, is destroyed after v2.
While Drain is satisfies Move
in order to be
move-constructed, it will panic on move-assignment.
Methods
sus::iter::ExactSizeIterator trait.
Keep unyielded elements in the source Vec
.