Expand description
§Interning System
This module provides a minimal system for global interning of values in
Rust. Interning allows you to deduplicate equal values and replace them with
cheap, copyable handles (Interned<T>) that support O(1) equality,
hashing, and compact storage.
§Core Concepts
Interned<T>: A compact, copyable handle to a deduplicated value.InterningTable<T>: Stores interned values and manages uniqueness.Internable: A trait for types that can be interned.
§Safety Note
The .get() method on Interned<T> returns a &'static T using an
internal transmute, assuming the backing storage (interning table) never
remove items from its table. This is guaranteed by the implementation of
InterningTable.
Structs§
- Explicit
Closure - A tiny,
FnOnce-compatible wrapper used to initialize aLazyLockwith a captured value. - Interned
- A statically interned value of type
T. - Interning
Table - An interning table storing unique values of
Tand assigning them stable indices.
Traits§
- Internable
- Types that have a single, process‑global interning table.
Type Aliases§
- Lazy
Lock NewWith Value - A type alias representing a lazily initialized
Mutex<InterningTable<T>>backed by a fixed-size array initializer.