I’ve just released version
vec , a library for safe dynamic arrays with Rust-like mutability permissions.
Based on recent feedback, I’ve revised the API to have more consistent permissions, following some simple rules:
Reading basic properties (
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
Please let me know if you have any feedback or suggestions!