|0.2.0||Dec 28, 2020|
|0.1.0||Dec 3, 2020|
#731 in Data structures
Allocation-free data structures that make do with the memory they're given.
This makes their temporal performance more consistent, and the memory footprint dead-simple to predict - but it also means insertions can easily fail, so you'll need proof you can't break the limit, or a graceful recovery path, which is good practice in memory-constrained environments anyway.
Currently, four main components are provided:
Arena, a bump-/stack-allocator, plus
Box<'a, T>the corresponding smart pointer,
Vec, a bounded, growable array, generic over not only the element type, but also the underlying storage type (as in this recent proposal) and the index type (inspired by
BinaryHeap, a priority queue implemented on top of
Deque, a double-ended queue implemented with a ring buffer.
This crate is still in early development! Currently on the roadmap (in no particular order):
slotmap-style pool-allocator, as well as a dense pool optimized for iteration speed, as opposed to random access,
- ordered and unordered map and set implementations.
To add coca as a dependency, add this to your project's
[dependencies] coca = "0.2"
alloc: By default, coca is
no_stdcompatible; this feature flag enables some trait implementations for conveniently working with heap-allocated storage.
nightly: If you're working with the nightly rust toolchain, you can enable this feature to get access to
ArrayVec, both of which are implemented using the nightly-only
min_const_genericsfeature; this flag will eventually be removed.
profile: Enables memory profiling in arenas; see the module-level documentation for details.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.