Trait Backend

Source
pub trait Backend<T: ?Sized> {
    type Symbol: BackendSymbol;

    // Required methods
    fn intern(&mut self, src: &T) -> Self::Symbol;
    fn get(&self, sym: Self::Symbol) -> Option<&T>;

    // Provided method
    unsafe fn get_unchecked(&self, sym: Self::Symbol) -> &T { ... }
}
Expand description

Backend for the Interner

Required Associated Types§

Required Methods§

Source

fn intern(&mut self, src: &T) -> Self::Symbol

Intern the element

Source

fn get(&self, sym: Self::Symbol) -> Option<&T>

Resolve the symbol

Provided Methods§

Source

unsafe fn get_unchecked(&self, sym: Self::Symbol) -> &T

Resolves the symbol, without checking if it exists on the backend.

§Safety

The caller must ensure that the symbol was retreived from a call to this backend’s intern function.

Implementors§

Source§

impl Backend<str> for StringBuf

Source§

type Symbol = Symbol

Source§

impl<T: Clone> Backend<T> for VecBackend<T>

Source§

type Symbol = Symbol