Skip to main content

Module interner

Module interner 

Source
Expand description

Arena-based string interner for memory-efficient string deduplication.

Stores all strings in a single contiguous buffer to minimize allocations and improve cache locality. Uses a hash-based lookup for O(1) interning.

§Example

use vtcode_commons::interner::StringInterner;

let mut interner = StringInterner::new();
let id1 = interner.intern("src/lib.rs");
let id2 = interner.intern("src/lib.rs");
assert_eq!(id1, id2);
assert_eq!(interner.get(id1), Some("src/lib.rs"));

Structs§

StringId
A compact identifier for an interned string.
StringInterner
Arena-based string interner for efficient string deduplication.