[][src]Trait arc_string_interner::Symbol

pub trait Symbol: Copy + Ord + Eq {
    fn from_usize(val: usize) -> Self;
fn to_usize(self) -> usize; }

Types implementing this trait are able to act as symbols for string interners.

Symbols are returned by StringInterner::get_or_intern and allow look-ups of the original string contents with StringInterner::resolve.

Note

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

Required methods

fn from_usize(val: usize) -> Self

Creates a symbol from a usize.

Note

Implementations panic if the operation cannot succeed.

fn to_usize(self) -> usize

Returns the usize representation of self.

Loading content...

Implementations on Foreign Types

impl Symbol for usize[src]

Loading content...

Implementors

impl Symbol for Sym[src]

fn from_usize(val: usize) -> Self[src]

Creates a Sym from the given usize.

Panics

If the given usize is greater than u32::MAX - 1.

Loading content...