Skip to main content

Crate hashcons_arena

Crate hashcons_arena 

Source
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 a RwLock, rather than a RefCell to implement interior mutability. This allows the arena to be Sync. Depends on the parking_lot crate.

§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
BoxedHashConsArena
A version of HashConsArena that ensures interned values are dropped.
HRef
HashConsArena
A hash consing arena that allows for efficient interning of values.