[][src]Trait string_interner::Symbol

pub trait Symbol: Copy + Eq {
    pub fn try_from_usize(index: usize) -> Option<Self>;
pub fn to_usize(self) -> usize; }

Types implementing this trait can be used as symbols for string interners.

The StringInterner::get_or_intern method returns Symbol types that allow to look-up the original string using StringInterner::resolve.

Note

Optimal symbols allow for efficient comparisons and have a small memory footprint.

Required methods

pub fn try_from_usize(index: usize) -> Option<Self>[src]

Creates a symbol from a usize.

Returns None if index is out of bounds for the symbol.

pub fn to_usize(self) -> usize[src]

Returns the usize representation of self.

Loading content...

Implementations on Foreign Types

impl Symbol for usize[src]

Loading content...

Implementors

impl Symbol for SymbolU16[src]

impl Symbol for SymbolU32[src]

impl Symbol for SymbolUsize[src]

Loading content...