Skip to main content

Crate once_vec

Crate once_vec 

Source
Expand description

OnceVec is a OnceCell-based grow-only vector.

It has the following properties:

  • It can only grow, elements once pushed cannot be removed.
  • Elements once pushed cannot be modified. (use interior mutability if you want to modify the elements)
  • Pushing new elements does not require a mutable reference.
  • Memory allocation happens in steps of powers of two.
  • The total size is limited 1 + 2 + 4 + ... + 2^(N-1) = 2^N - 1, where N is the number of chunks, which is a const generic parameter.
  • It does not implement Sync; shared concurrent access is not supported.
  • Written entirely in safe rust.

Re-exports§

pub extern crate alloc;

Structs§

OnceVec
A grow-only array with a maximum size of 2^N - 1. See the module-level documentation for more details.