#string-interning #symbol-table #projects

symbol_interner

A simple string interner / symbol table for Rust projects

3 releases

0.1.2 Nov 17, 2021
0.1.1 Nov 17, 2021
0.1.0 Nov 17, 2021

#21 in #symbol-table

MIT license

5KB
72 lines

Symbol Interner

A small Rust crate that provides a naïve string interner. Consult the [documentation] to learn about the types that are exposed.

Installation

Add the following to your Cargo.toml file:

[dependencies]
symbol_interner = "0.1"

Usage

You can create a new interner and store symbols using the Interner::new() and Interner.intern() methods.

use symbol_interner::prelude::*;

let mut interner = Interner::default();
let mut offset: Result<usize, InternerError> = interner.intern(String::from("Ryan"));

assert_eq!(offset.unwrap(), 0);

No runtime deps