1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Backend adapters for lattice storage and vocabulary management.
//!
//! This module provides a trait-based abstraction over different dictionary
//! and storage backends. The design supports:
//!
//! - **Generic backends**: Work with any hashmap-like storage
//! - **PathMap backends**: Optimized for structural sharing (via `f1r3fly` feature)
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────────────┐
//! │ LatticeBackend Trait │
//! ├─────────────────────────────────────────────────────────────────────────┤
//! │ │
//! │ ┌──────────────────────┐ ┌──────────────────────────────────────┐ │
//! │ │ HashMapBackend │ │ PathMapBackend (#[cfg(f1r3fly)]) │ │
//! │ │ - Simple vocabulary │ │ - Structural sharing │ │
//! │ │ - No sharing │ │ - Copy-on-write │ │
//! │ └──────────────────────┘ │ - S-expression paths │ │
//! │ └──────────────────────────────────────┘ │
//! └─────────────────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Usage
//!
//! For most use cases, use [`HashMapBackend`] which provides simple vocabulary
//! interning without external dependencies:
//!
//! ```rust
//! use lling_llang::backend::{LatticeBackend, HashMapBackend};
//!
//! let mut backend = HashMapBackend::new();
//! let id1 = backend.intern("hello");
//! let id2 = backend.intern("world");
//! let id3 = backend.intern("hello"); // Returns same id as id1
//!
//! assert_eq!(id1, id3);
//! assert_eq!(backend.lookup(id1), Some("hello"));
//! ```
pub use HashMapBackend;
pub use ;
pub use ;