simple-symbol
There are already a lot of string interning libraries out there, so this one is mostly just for my personal use case: writing a compiler without passing around a struct everywhere.
Usage
extern crate simple_symbol;
use store;
Symbols are compared via usize indices, and automatically
query the global SYMBOL_TABLE struct when printing or converting.
Limitations
- Single thread only (uses
thread_local!macro) - Allocates every
Stringtwice (once as aHashMapkey, once as aVecentry) - Currently no garbage-collecting mechanism for unused cached Strings.
Changelog
1.0.0
Derive PartialOrd and Ord for Symbol for easier use as keys in crates like petgraph.
0.1.0
Initial implementation.