[][src]Struct lasso::RodeoResolver

pub struct RodeoResolver<K = Spur> { /* fields omitted */ }

A read-only view of a Rodeo or ThreadedRodeo that allows contention-free access to interned strings with only key to string resolution

The key type is the same as the Rodeo or ThreadedRodeo that created it

Implementations

impl<K> RodeoResolver<K>[src]

pub fn resolve<'a>(&'a self, key: &K) -> &'a str where
    K: Key
[src]

Resolves a string by its key. Only keys made by the current Resolver or the creator of the current Resolver may be used

Panics

Panics if the key is out of bounds

Example

use lasso::Rodeo;

// ThreadedRodeo is interchangeable for Rodeo here
let mut rodeo = Rodeo::default();
let key = rodeo.get_or_intern("Strings of things with wings and dings");

let rodeo = rodeo.into_resolver();
assert_eq!("Strings of things with wings and dings", rodeo.resolve(&key));

pub fn try_resolve<'a>(&'a self, key: &K) -> Option<&'a str> where
    K: Key
[src]

Resolves a string by its key, returning None if the key is out of bounds. Only keys made by the current Resolver or the creator of the current Resolver may be used

Example

use lasso::Rodeo;

// ThreadedRodeo is interchangeable for Rodeo here
let mut rodeo = Rodeo::default();
let key = rodeo.get_or_intern("Strings of things with wings and dings");

let rodeo = rodeo.into_resolver();
assert_eq!(Some("Strings of things with wings and dings"), rodeo.try_resolve(&key));

pub unsafe fn resolve_unchecked<'a>(&'a self, key: &K) -> &'a str where
    K: Key
[src]

Resolves a string by its key without bounds checking

Safety

The key must be valid for the current interner

Example

use lasso::Rodeo;

// ThreadedRodeo is interchangeable for Rodeo here
let mut rodeo = Rodeo::default();
let key = rodeo.get_or_intern("Strings of things with wings and dings");

let rodeo = rodeo.into_resolver();
unsafe {
    assert_eq!("Strings of things with wings and dings", rodeo.resolve_unchecked(&key));
}

pub fn len(&self) -> usize[src]

Gets the number of interned strings

Example

use lasso::Rodeo;

// ThreadedRodeo is interchangeable for Rodeo here
let mut rodeo = Rodeo::default();
rodeo.get_or_intern("Documentation often has little hidden bits in it");

let rodeo = rodeo.into_resolver();
assert_eq!(rodeo.len(), 1);

pub fn is_empty(&self) -> bool[src]

Returns true if there are no currently interned strings

Example

use lasso::Rodeo;

// ThreadedRodeo is interchangeable for Rodeo here
let rodeo = Rodeo::default();

let rodeo = rodeo.into_resolver();
assert!(rodeo.is_empty());

pub fn iter(&self) -> Iter<K>[src]

Returns an iterator over the interned strings and their key values

pub fn strings(&self) -> Strings<K>[src]

Returns an iterator over the interned strings

Trait Implementations

impl<K: Debug> Debug for RodeoResolver<K>[src]

impl<K: Send> Send for RodeoResolver<K>[src]

impl<K: Sync> Sync for RodeoResolver<K>[src]

Auto Trait Implementations

impl<K> RefUnwindSafe for RodeoResolver<K> where
    K: RefUnwindSafe

impl<K> Unpin for RodeoResolver<K> where
    K: Unpin

impl<K> UnwindSafe for RodeoResolver<K> where
    K: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.