Expand description

VecCell, a variant of Vec with interior mutability

This crate contains the VecCell<T> type, which implements a contiguous, growable array (similar to Vec<T>) with interior mutability (similar to RefCell<T>).

You would use this crate if:

  • You need a Vec with interior mutability
  • You only want mutable access to one element at a time
  • You want immutable access to all other elements while an element is borrowed mutably
  • You need a constant memory cost

You would need something else if:

  • You don’t need interior mutability (you may use Vec<T> instead)
  • While an element is borrowed mutably, you don’t need to access the others (you may use RefCell<Vec<T>> instead)
  • You want mutable access to multiple elements at a time (you may use Vec<RefCell<T>> instead)
  • You need to share the array across multiple threads (you may use Vec<Mutex<T>> or Arc<Vec<Mutex<T>>> instead)

Structs

A contiguous, growable array type with interior mutability.

Iterator returned by VecCell::into_iter

Iterator returned by VecCell::iter

Wraps a borrowed reference from a VecCell.

Wraps a mutably borrowed value from a VecCell.