Expand description
A hash consing arena for efficient interning of values.
This arena allows you to intern values such that structurally equal values will yield the same reference, thus saving memory and improving performance in scenarios where many identical values are used.
§Features
sync: Use aRwLock, rather than aRefCellto implement interior mutability. This allows the arena to beSync. Depends on theparking_lotcrate.
§Example
ⓘ
use hashcons_arena::HashConsArena;
let arena = HashConsArena::new();
let a = arena.intern("hello");
let b = arena.intern("hello");
assert!(a == b); // a and b are the same reference§Safety
The crate uses unsafe in a number of places, and has been tested using miri.
Structs§
- AsVal
- Boxed
Hash Cons Arena - A version of
HashConsArenathat ensures interned values are dropped. - HRef
- Hash
Cons Arena - A hash consing arena that allows for efficient interning of values.