Open GnomedDev opened 4 months ago
We can collect directly into the Box<[T]> to avoid pushing to a Vec, which could overallocate and require a reallocation when shrinking in Vec::into_boxed_slice or have to reallocate multiple times as it wouldn't know the finishing capacity.
Box<[T]>
Vec
Vec::into_boxed_slice
We can collect directly into the
Box<[T]>
to avoid pushing to aVec
, which could overallocate and require a reallocation when shrinking inVec::into_boxed_slice
or have to reallocate multiple times as it wouldn't know the finishing capacity.