Trait InternerSymbol

Source
pub trait InternerSymbol:
    Sized
    + Copy
    + Hash
    + Eq {
    // Required methods
    fn try_from_usize(id: usize) -> Option<Self>;
    fn to_usize(self) -> usize;

    // Provided method
    fn from_usize(id: usize) -> Self { ... }
}
Expand description

Trait for types that can be used as symbols in an Interner.

Required Methods§

Source

fn try_from_usize(id: usize) -> Option<Self>

Tries to create a new Symbol from a usize.

Source

fn to_usize(self) -> usize

Converts the Symbol to a usize.

Provided Methods§

Source

fn from_usize(id: usize) -> Self

Creates a new Symbol from a usize.

§Panics

Panics if id is an invalid index for Self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§