Struct lasso::RodeoResolver [−][src]
pub struct RodeoResolver<K = Spur> { /* fields omitted */ }
Expand description
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]
impl<K> RodeoResolver<K>
[src]pub fn resolve<'a>(&'a self, key: &K) -> &'a str where
K: Key,
[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]
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]
pub unsafe fn resolve_unchecked<'a>(&'a self, key: &K) -> &'a str where
K: Key,
[src]Resolves a string by its key without preforming bounds checks
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 contains_key(&self, key: &K) -> bool where
K: Key,
[src]
pub fn contains_key(&self, key: &K) -> bool where
K: Key,
[src]Returns true
if the given key exists in the current interner
Example
use lasso::Rodeo; let mut rodeo = Rodeo::default(); let key = rodeo.get_or_intern("Strings of things with wings and dings"); let rodeo = rodeo.into_resolver(); assert!(rodeo.contains_key(&key)); assert!(!rodeo.contains_key(&key_that_doesnt_exist));
pub fn len(&self) -> usize
[src]
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]
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());
Trait Implementations
impl<K: Debug> Debug for RodeoResolver<K>
[src]
impl<K: Debug> Debug for RodeoResolver<K>
[src]impl<'de, K: Key> Deserialize<'de> for RodeoResolver<K>
[src]
impl<'de, K: Key> Deserialize<'de> for RodeoResolver<K>
[src]fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl<K: Key> Index<K> for RodeoResolver<K>
[src]
impl<K: Key> Index<K> for RodeoResolver<K>
[src]impl<'a, K: Key> IntoIterator for &'a RodeoResolver<K>
[src]
impl<'a, K: Key> IntoIterator for &'a RodeoResolver<K>
[src]impl<K, S> PartialEq<Rodeo<K, S>> for RodeoResolver<K>
[src]
impl<K, S> PartialEq<Rodeo<K, S>> for RodeoResolver<K>
[src]impl<K, S> PartialEq<RodeoReader<K, S>> for RodeoResolver<K>
[src]
impl<K, S> PartialEq<RodeoReader<K, S>> for RodeoResolver<K>
[src]impl<K, S> PartialEq<RodeoResolver<K>> for RodeoReader<K, S>
[src]
impl<K, S> PartialEq<RodeoResolver<K>> for RodeoReader<K, S>
[src]impl<K> PartialEq<RodeoResolver<K>> for RodeoResolver<K>
[src]
impl<K> PartialEq<RodeoResolver<K>> for RodeoResolver<K>
[src]impl<K, S> PartialEq<RodeoResolver<K>> for Rodeo<K, S>
[src]
impl<K, S> PartialEq<RodeoResolver<K>> for Rodeo<K, S>
[src]impl<K, S> PartialEq<RodeoResolver<K>> for ThreadedRodeo<K, S> where
K: Eq + Hash + Key,
S: Clone + BuildHasher,
[src]
impl<K, S> PartialEq<RodeoResolver<K>> for ThreadedRodeo<K, S> where
K: Eq + Hash + Key,
S: Clone + BuildHasher,
[src]impl<K> Resolver<K> for RodeoResolver<K> where
K: Key,
[src]
impl<K> Resolver<K> for RodeoResolver<K> where
K: Key,
[src]fn try_resolve<'a>(&'a self, key: &K) -> Option<&'a str>
[src]
fn try_resolve<'a>(&'a self, key: &K) -> Option<&'a str>
[src]Attempts to resolve the given key into a string, returning None
if it cannot be found Read more
unsafe fn resolve_unchecked<'a>(&'a self, key: &K) -> &'a str
[src]
unsafe fn resolve_unchecked<'a>(&'a self, key: &K) -> &'a str
[src]Resolves a string by its key without preforming bounds checks Read more
fn contains_key(&self, key: &K) -> bool
[src]
fn contains_key(&self, key: &K) -> bool
[src]Returns true
if the current interner contains the given key
impl<K> Serialize for RodeoResolver<K>
[src]
impl<K> Serialize for RodeoResolver<K>
[src]impl<K> Eq 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,
K: RefUnwindSafe,
impl<K> Unpin for RodeoResolver<K> where
K: Unpin,
K: Unpin,
impl<K> UnwindSafe for RodeoResolver<K> where
K: UnwindSafe,
K: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,