Trait lasso::Resolver

source ·
pub trait Resolver<K = Spur> {
    // Required methods
    fn resolve<'a>(&'a self, key: &K) -> &'a str;
    fn try_resolve<'a>(&'a self, key: &K) -> Option<&'a str>;
    unsafe fn resolve_unchecked<'a>(&'a self, key: &K) -> &'a str;
    fn contains_key(&self, key: &K) -> bool;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A generic interface that allows using any underlying interner only for its resolution capabilities, allowing only key -> str lookups

Required Methods§

source

fn resolve<'a>(&'a self, key: &K) -> &'a str

Resolves the given key into a string

Panics

Panics if the key is not contained in the current Resolver

source

fn try_resolve<'a>(&'a self, key: &K) -> Option<&'a str>

Attempts to resolve the given key into a string, returning None if it cannot be found

source

unsafe fn resolve_unchecked<'a>(&'a self, key: &K) -> &'a str

Resolves a string by its key without preforming bounds checks

Safety

The key must be valid for the current Resolver

source

fn contains_key(&self, key: &K) -> bool

Returns true if the current interner contains the given key

source

fn len(&self) -> usize

Gets the number of currently interned strings

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if there are no currently interned strings

Implementations on Foreign Types§

source§

impl<T, K> Resolver<K> for &mut Twhere T: Resolver<K>,

source§

fn resolve<'a>(&'a self, key: &K) -> &'a str

source§

fn try_resolve<'a>(&'a self, key: &K) -> Option<&'a str>

source§

unsafe fn resolve_unchecked<'a>(&'a self, key: &K) -> &'a str

source§

fn contains_key(&self, key: &K) -> bool

source§

fn len(&self) -> usize

source§

impl<K, I> Resolver<K> for Box<I>where K: Key, I: Resolver<K> + ?Sized + 'static,

source§

fn resolve<'a>(&'a self, key: &K) -> &'a str

source§

fn try_resolve<'a>(&'a self, key: &K) -> Option<&'a str>

source§

unsafe fn resolve_unchecked<'a>(&'a self, key: &K) -> &'a str

source§

fn contains_key(&self, key: &K) -> bool

source§

fn len(&self) -> usize

source§

impl<T, K> Resolver<K> for &Twhere T: Resolver<K>,

source§

fn resolve<'a>(&'a self, key: &K) -> &'a str

source§

fn try_resolve<'a>(&'a self, key: &K) -> Option<&'a str>

source§

unsafe fn resolve_unchecked<'a>(&'a self, key: &K) -> &'a str

source§

fn contains_key(&self, key: &K) -> bool

source§

fn len(&self) -> usize

Implementors§

source§

impl<K> Resolver<K> for RodeoResolver<K>where K: Key,

source§

impl<K, S> Resolver<K> for Rodeo<K, S>where K: Key,

source§

impl<K, S> Resolver<K> for RodeoReader<K, S>where K: Key,

source§

impl<K, S> Resolver<K> for ThreadedRodeo<K, S>where K: Key + Hash, S: BuildHasher + Clone,