[][src]Trait artichoke_core::intern::Intern

pub trait Intern {
    type Symbol: Copy;
    fn intern_symbol<T>(&mut self, symbol: T) -> Self::Symbol
    where
        T: Into<Cow<'static, [u8]>>
;
fn lookup_symbol(&self, symbol: Self::Symbol) -> Option<&[u8]>; }

Store and retrieve byte vectors that have the same lifetime as the interpreter.

See the Ruby Symbol type.

Associated Types

type Symbol: Copy

Concrete type for symbol identifiers.

The symbol identifier enables lookups in the underlying storage.

Loading content...

Required methods

fn intern_symbol<T>(&mut self, symbol: T) -> Self::Symbol where
    T: Into<Cow<'static, [u8]>>, 

Store an immutable byte vector for the life of the interpreter.

Returns an identifier that enables retrieving the original bytes.

fn lookup_symbol(&self, symbol: Self::Symbol) -> Option<&[u8]>

Retrieve the original byte content of an interned vector.

Returns None if the symbol identifier is invalid.

Loading content...

Implementors

Loading content...