Skip to content

`grow_to` method is implemented

Compare
Choose a tag to compare
@orxfun orxfun released this 22 Mar 03:27
· 64 commits to main since this release

Increases the capacity of the vector at least up to the new_capacity:

  • has no affect if new_capacity <= self.capacity(), and returns Ok(self.capacity());
  • increases the capacity to x >= new_capacity otherwise if the operation succeeds.

This method is unsafe due to the internal guarantees of pinned vectors.

  • A SplitVec, on the other hand, can grow to the new_capacity without any problem.
    However, it is not designed to have intermediate empty fragments, while grow_to can leave such fragments.
    Hence, the caller is responsible for handling this.