Trait symtern::traits::Intern [] [src]

pub trait Intern {
    type Input: ?Sized;
    type Symbol: Symbol + Symbol;
    fn intern(self, value: &Self::Input) -> Result<Self::Symbol>;
}

Primary interface for interner implementations. For a given type T, this type should implemented for &'a T or &'a mut T.

Associated Types

Type of value accepted by intern.

Type used to represent interned values.

Required Methods

Fetch the symbol that corresponds to the given value. If the value does not map to any existing symbol, create and return a new one. This method may return an error if the interner encounters any error while storing the value.

let symbol = match some_interner.intern("Rosebud") {
    Ok(sym) => sym,
    Err(err) => return Err(MyErrorType::from(err)),
};

Implementors