[ANN] vec 0.3.0

I’ve just released version 0.3.0 of vec , a library for safe dynamic arrays with Rust-like mutability permissions.

You can find the package on opam here, and the source repository here.

Based on recent feedback, I’ve revised the API to have more consistent permissions, following some simple rules:

  • Reading basic properties (length, capacity, growth_rate) requires no permissions
  • Operations that return or indirectly give access to the vector’s elements (i.e. by passing them to a user-provided function) require read permission
  • Operations that mutate the vector’s state (including modifying its elements, resizing its buffer or modifying growth rate) require write permission

I’ve also added some new APIs for inserting and removing elements at arbitrary indexes, and reworked how ensure_capacity works: Now ensure_capacity n v ensures that v's buffer has at least n free slots, rather than ensuring v's total capacity is at least n.

Please let me know if you have any feedback or suggestions!

4 Likes