Closed Jujstme closed 8 months ago
I don't follow. Vec's ownership just gets moved.
EDIT: oh, I understand now.
Mmh, I wonder if it would be better to provide the vector as a
vec: &mut Vec<T>
, where it then is able to reuse the allocation at least.
It's possible but it means the user will be limited by the capacity()
provided when instancing the Vec.
I can probably provide both methods.
read_into_vec()
has now been updated in order to use reserve(
), this way the Vec
is guaranteed to have the capacity needed to read from memory the amount of data specified in the method call
Mmh, I wonder if it would be better to provide the vector as a
vec: &mut Vec<T>
, where it then is able to reuse the allocation at least.