Skip to main content

Crate compact

Crate compact 

Source
Expand description

This crate makes it possible to store objects containing dynamic fields either compactly in consecutive memory or using traditional heap pointers.

Bread-and-butter datastructures are offered, they feature:

  • transparent access semantics, independent of currently used storage
  • automatic spill from exhausted compact storage to heap storage
  • recursive re-compaction

This is used in Kay for:

  • Storing actor state compactly in one place for cache coherency and easy persistence
  • Sending complex, dynamically-sized messages over boundaries such as actors, threads and the network

Structs§

CDict
A simple linear-search key-value dictionary, implemented using two CompactVec’s, one for keys, one for values.
CHashMap
A dynamically-sized open adressing quadratic probing hashmap that can be stored in compact sequential storage and automatically spills over into free heap storage using Allocator.
COption
A wrapper to make an Option of a nontrivial Compact possible. Unfortunately, we can’t blanket-impl that, since that overlaps (for the compiler) with the impl for trivial Copy types…
CString
A compact storage for a String. So far doesn’t support direct mutable operations, Only conversion from and to String/&str
CVec
A dynamically-sized vector that can be stored in compact sequential storage and automatically spills over into free heap storage using Allocator. Tries to closely follow the API of std::vec::Vec, but is not complete.

Traits§

Compact
A trait for objects with a statically-sized part and a potential dynamically-sized part that can be stored both compactly in consecutive memory or freely on the heap