An interner for data of mixed / arbitrary type. It uses weak references and the default allocator so it can be used in long-running processes.
use env;
use PathBuf;
use ;
// Intern a value
let a: = i;
// Intern a path
let b: = i;
Some convenience methods are also provided to make working with lists easier
use ;
// Intern a list as a slice of tokens
let v1: = i;
// Intern a list of internable values
let v2: =
iv;
// Intern a list of the borrowed form of internable values
let v3: = ibv;
assert!
The interner uses weak references but the unreferenced values still take up
space in the token table. To avoid a memory leak, you can periodically
sremove entries referring to unreferenced values from the interner with
sweep
or sweep_t
.
use ;
// use this for general housekeeping
sweep;
// use this if a lot of temporary values of a particular interned type
// had been dropped recently
sweep_t::;