#package #repository #io #vec-deque #internal #refcell #check

nightly deque_cell

Repository for crates.io deque_cell package

1 unstable release

Uses old Rust 2015

0.1.0 Aug 18, 2015

#16 in #vec-deque

3KB
92 lines

deque_cell

Provides an efficient wrapper around VecDeque, enabling safe internal mutability without the overhead of RefCell's runtime checks.

API

Method names match those of VecDeque, but mutating methods take &self rather than &mut self. Safety is preserved by disallowing internal references to the VecDeque.

Example use

DequeCell<T> can be used to store a queue of actions to perform when mutable access to a resource is possible. When mutable access is gained, each action can be popped from the queue and executed, with exclusive access to the resource. Due to the internal mutability of the queue, these actions can themselves push additional actions onto the queue.

No runtime deps