[ParaCord] is a lightweight, thread-safe, memory efficient string interner.
When calling [ParaCord::get_or_intern], a [Key] is returned. This [Key] is guaranteed to be unique if the input string is unique,
and is guaranteed to be the same if the input string is the same. [Key] is 32bits, and has a niche value which allows Option<Key> to
also be 32bits.
The 32bit key imposes a limitation that allocating 232 strings will panic. There's an additional self-imposed limitation that no string can be longer than 232 bytes long.
If you don't want to intern the string, but check for it's existence, you can use [ParaCord::get], which returns None if not
present.
[Key]s can be exchanged back into strings using [ParaCord::resolve]. It's important to keep in mind that this might panic
or return nonsense results if given a key returned by some other [ParaCord] instance.
This string interner is not garbage collected, so strings that are allocated in the interner are not released
until the [ParaCord] instance is dropped.
Examples
With a self-managed ParaCord instance.
use ParaCord;
let paracord = default;
let foo = paracord.get_or_intern;
let bar = paracord.get_or_intern;
assert_ne!;
// returns the same key, no insert
let foo2 = paracord.get_or_intern;
assert_eq!;
// returns the same key, guaranteed no insert
let foo3 = paracord.get.unwrap;
assert_eq!;
// can be exchanged for the string
assert_eq!;
assert_eq!;
With a globally managed instance, with typed keys
custom_key!