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.
Example
use ;
Symbols are compared via usize indices, and automatically
query the global INTERNER struct when printing or converting.
Limitations
Leaks all interned Strings for the duration of the program. Unsuitable for long-running programs.
Changelog
-
3.1.0
- Compare using lexicographic order instead of insertion order, which is slower, but stable.
- Switch to
once_cellfromlazy_static.
-
3.0.0
- Change
internfunction to take the more commonS: AsRef<str>instead ofS: Into<Cow<'a, str>>. - Add a new
intern_staticfunction to avoid leaking already'staticdata.
- Change
-
2.0.0
- Leak Strings instead of double-allocating.
- Change to RwLock and use
lazy_staticto support multi-threaded programs. - Update API.
-
1.0.0
- Derive
PartialOrdandOrdforSymbolfor easier use as keys in crates likepetgraph.
- Derive
-
0.1.0
- Initial implementation.