Crate opt_vec

source ·
Expand description

A contiguous growable array type with heap-allocated contents with fast deletion process.

This is a wrapper for Vec<Option<T>>

Use an OptVec when:

  • You want fast random access and deletion, but don’t want to use expensive structures like HashMap.
  • You want to guarantee that the same index keeps the same value even if another element is removed.

Getting Started

Cargo.toml

[dependencies]
opt_vec = "*"

and then

use opt_vec::OptVec;

let mut v = OptVec::new();
v.push(1);

Support no_std

Cargo.toml

[dependencies.opt_vec]
version = "*"
default-features = false
features = ["alloc"]

Structs

  • A contiguous growable array type with heap-allocated contents with fast deletion process.