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.
```rust extern crate simple_symbol;
use simple_symbol::store;
fn main() {
let symbola = store("String"); let symbolb = store("String");
asserteq!(symbola, symbol_b);
let symbol_c = store("string");
assertne!(symbola, symbol_c);
// Prints "String" println!("{}", symbol_a);
let original: String = symbol_a.into();
asserteq!(original, "String".tostring()); } ```
Symbols are compared via usize
indices, and automatically
query the global SYMBOL_TABLE
struct when printing or converting.
thread_local!
macro)String
twice (once as a HashMap
key, once as a Vec
entry)1.0.0
Derive PartialOrd
and Ord
for Symbol
for easier use as keys in crates like petgraph
.
0.1.0
Initial implementation.