Crates.io | tiny-interner |
lib.rs | tiny-interner |
version | 0.1.5 |
source | src |
created_at | 2023-04-22 20:03:45.190773 |
updated_at | 2023-04-22 20:18:19.614008 |
description | Easy to use string interner with fast access to underlying strings and minimal memory footprint. |
homepage | |
repository | https://github.com/abs0luty/tiny-interner |
max_upload_size | |
id | 846138 |
size | 12,160 |
tiny_interner
crate.~300 lines of Rust code that implement string internering for your programming language compiler.
fn main() {
let interner = Interner::default();
let s1 = interner.get_or_intern("test");
let s2 = interner.get_or_intern("test");
assert_eq!(s1, s2);
assert_eq!(interner.resolve(0).unwrap(), "test");
}