Expand description
cds is a Collection of Optimized Data Structures.
cds implements optimized data structures and their associated algorithms.
Design and Implementation Principles
- Tested - for both correctness and performance
- Fast - even if it requires
unsafe
Rust - Secure - do not unnecessarily hold a copy of (possibly sensitive) user data; allow wiping of unused memory
- No malloc - avoid dynamic memory allocation where possible
- Compact - allow small memory footprint
Fixed-Capacity Data Structures
Fixed-capacity data structures can be allocated on stack. They do not allocate memory on the heap, and their capacity cannot be dynamically changed.
ArrayVec
- a vector-like arrayArrayString
- a string-like array
Hybrid-Capacity Data Structures
Hybrid-capacity data structures use both local and heap capacity. They have some local capacity, which, if not exceeded, avoids heap allocation. Once the amount of needed capacity exceeds the local capacity, a heap allocation is made, existing data is copied to the heap, and the data structure continues its operation from there.
SmallVec
- a vector with “small size” optimization
Optional Features
alloc
- enables usage of the standardalloc
cratestd
- impliesalloc
and enables implementation ofstd
traits which are not available incore
. Without this feature the library isno_std
.arrayvec
- enablesArrayVec
arraystring
- enablesArrayString
smallvec
- impliesalloc
and enablesSmallVec
By default, all optional features are enabled. To build in no_std
environment, or to avoid
compilation of unneeded functionality, disable default features and cherry pick the required
features explicitly.
Modules
arraystring
arrayvec
smallvec
Macros
arraystring
ArrayString
.arraystring
ArrayString
containing the arguments.arraystring
ArrayString
possibly truncating the result.