string-intern 0.1.7

Another implementation of string interning. Unique features: allows to define a type for each kind of interned values and a validator for the values of that type.
Documentation
use std::fmt;
use std::error::Error;

use Symbol;


/// This is validator trait you should implement for your own symbols
///
/// In reality this trait serves three purposes:
///
/// 1. Validates that atom contains only value you expect it to contain
/// 2. Identifies the type i.e. `type S1 = Symbol<V1>` and
///    `type S2 = Symbol<V2>` are different and incompatible types
/// 3. Allows to override `Display` trait for your own symbol
pub trait Validator {
    type Err: Error;
    fn validate_symbol(&str) -> Result<(), Self::Err>;
    fn display(value: &Symbol<Self>, fmt: &mut fmt::Formatter) -> fmt::Result {
        write!(fmt, "i{:?}", value.as_ref())
    }
}