vec: add `shrink_to_fit`

Closes #4960