Struct Interner

pub(in ::bridge::symbol) struct Interner { pub(in ::bridge::symbol) arena: Arena, pub(in ::bridge::symbol) names: HashMap<&'static str, Symbol, BuildHasherDefault<FxHasher>>, pub(in ::bridge::symbol) strings: Vec<&'static str>, pub(in ::bridge::symbol) sym_base: NonZero<u32> }

Basic interner for a Symbol, inspired by the one in rustc_span.

Fields

arena: Arena
names: HashMap<&'static str, Symbol, BuildHasherDefault<FxHasher>>
strings: Vec<&'static str>
sym_base: NonZero<u32>

Implementations

impl Interner

fn intern(&mut self, string: &str) -> Symbol
fn get(&self, symbol: Symbol) -> &str

Reads a symbol's value from the store while it is held.

fn clear(&mut self)

Clear all symbols from the store, invalidating them such that get will panic if they are accessed in the future.

Auto Trait Implementations

impl !Freeze for Interner

impl !RefUnwindSafe for Interner

impl !Send for Interner

impl !Sync for Interner

impl Unpin for Interner

impl UnsafeUnpin for Interner

impl UnwindSafe for Interner

Blanket Implementations

impl<T> Any for Interner where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Interner where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Interner where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for Interner

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Interner where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Interner

impl<T, U> Into<U> for Interner where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Interner where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Interner where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>