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>>
orArc<Vec<Mutex<T>>>
instead)
Structs§
- VecCell
- A contiguous, growable array type with interior mutability.
- VecCell
Into Iter - Iterator returned by
VecCell::into_iter
- VecCell
RefIter - Iterator returned by
VecCell::iter
- VecRef
- Wraps a borrowed reference from a
VecCell
. - VecRef
Mut - Wraps a mutably borrowed value from a
VecCell
.