String Interner
Linux | Windows | Coverage | Docs | Crates.io | 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.2
- added
shrink_to_fit
public method toStringInterner
- (by artemshein)
- added
-
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!)
- fixed a bug that inserting non-owning string types (e.g.
-
0.6.0
- added optional serde serialization and deserialization support
- more efficient and generic
PartialEq
implementation forStringInterner
- made
StringInterner
generic overBuildHasher
to allow for custom hashers
-
0.5.0
- added
IntoIterator
trait implementation forStringInterner
- greatly simplified iterator code
- added
-
0.4.0
- removed restrictive constraint for
Unsigned
forSymbol
- removed restrictive constraint for
-
0.3.3
- added
Send
andSync
toInternalStrRef
to makeStringInterner
itselfSend
andSync
- added