6 releases

0.2.3 Feb 5, 2024
0.2.2 Feb 5, 2024
0.1.4 Feb 4, 2024

#767 in Rust patterns

Download history 9/week @ 2024-02-02 4/week @ 2024-02-16 20/week @ 2024-02-23 9/week @ 2024-03-01 5/week @ 2024-03-08 15/week @ 2024-03-15 45/week @ 2024-03-29 9/week @ 2024-04-05

54 downloads per month

MIT/Apache

13KB
350 lines

Interning

Interning is the process of storing only one copy of each distinct string value, which must be immutable. This process is used to save memory space and improve performance.

Usage

Add dependencies to your Cargo.toml:

[dependencies]
interning = "0.2"
use interning::InternedString;
fn main() {
    let s1 = InternedString::new("hello");
    let s2 = InternedString::new("hello");
    assert_eq!(s1, s2);
}

Change Log

  • 0.1.0
    • Initial release
  • 0.2.0
    • Inline small strings
  • 0.2.1
    • Add InternedStringHash for endianness-independent hashing and user-friendly API

Dependencies

~4–10MB
~101K SLoC