#string-interning #memory #unique-id

intern_string

Fast and memory efficient string interning for Rust

2 unstable releases

0.2.0 Jan 7, 2024
0.1.0 Jan 5, 2024

#22 in #string-interning

32 downloads per month

MIT license

6KB
65 lines

String Interning

Fast and efficient string interning with a simple API.

Features

  • Intern strings and get a unique ID for each string.
  • Initialize with a pre-allocated capacity.

Installation

Add the following to your Cargo.toml:

[dependencies]
intern_string = "0.1.0"

Usage

use intern_string::Intern;

let mut interner = Intern::new();
let id = interner.intern("hello");
assert_eq!(interner.lookup(id), 0);

Dependencies

~135KB