Crate internment [] [src]

The internment crate provides an Intern<T> type, which interns an object of type T. The Intern<T> stores a pointer to the object T, with the guarantee that a single data value (as defined by Eq and Hash) will correspond to a single pointer value. This means that we can use pointer comparison (and a pointer hash) in place of value comparisons, which is faster.

Example

use internment::Intern;
let x = Intern::new("hello");
let y = Intern::new("world");
assert_ne!(x, y);

Structs

Intern

A pointer to an interned object.