string-interner 0.6.1

A string interning data structure that was designed for minimal memory-overhead and fast access to the underlying interned string contents.
Documentation

String Interner

Linux Windows Coverage Docs Crates.io Licence
travisCI appveyor coveralls licence chat licence

A string interning data structure that was designed for minimal memory overhead, fast access to the underlying interned strings and cache-efficient iteration through its contents.

This implementation uses a similar API as the string interner of the Rust compiler.

What is a string interner?

String internment is an efficient bi-directional mapping between strings and very cheap identifiers (symbols) that are used as representant for a certain string instead of the string itself.

Internals

Internally a hashmap and a vector is used. The vector stored the true contents of interned strings while the hashmap has internal references into the internal vector to avoid duplicates.

Planned Features

  • Safe abstraction wrapper that protects the user from the following misusage

    • Using symbols of a different string interner instance to resolve string in another
    • Using symbols that are already no longer valid (i.e. the associated string interner is no longer available)
  • Even more flexibility for input into the string interner

Changelog

  • 0.6.1

    • fixed a bug that inserting non-owning string types (e.g. str) was broken due to dangling pointers (Thanks to artemshein for fixing it!)
  • 0.6.0

    • added optional serde serialization and deserialization support
    • more efficient and generic PartialEq implementation for StringInterner
    • made StringInterner generic over BuildHasher to allow for custom hashers
  • 0.5.0

    • added IntoIterator trait implementation for StringInterner
    • greatly simplified iterator code
  • 0.4.0

    • removed restrictive constraint for Unsigned for Symbol
  • 0.3.3

    • added Send and Sync to InternalStrRef to make StringInterner itself Send and Sync