pub trait Internable: Hash + Eq {
    // Required methods
    fn leak(&self) -> &'static Self;
    fn ref_eq(&self, other: &Self) -> bool;
    fn ref_hash<H: Hasher>(&self, state: &mut H);
}
Expand description

A trait for internable values.

This is used by Interner<T> to create static references for values that are interned.

Required Methods§

source

fn leak(&self) -> &'static Self

Creates a static reference to self, possibly leaking memory.

source

fn ref_eq(&self, other: &Self) -> bool

Returns true if the two references point to the same value.

source

fn ref_hash<H: Hasher>(&self, state: &mut H)

Feeds the reference to the hasher.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Internable for str

source§

fn leak(&self) -> &'static Self

source§

fn ref_eq(&self, other: &Self) -> bool

source§

fn ref_hash<H: Hasher>(&self, state: &mut H)

Implementors§