[−][src]Struct lasso::ResolverLasso
A read-only view of a Lasso
that allows contention-free access to interned strings, but only for key
-> str
resolution
Made with the Lasso::into_resolver
or ReadOnlyLasso::into_resolver
methods, the key type defaults to the ones used by the Lasso
that created it
Methods
impl<K: Key> ResolverLasso<K>
[src]
pub fn resolve<'a>(&'a self, key: &K) -> &'a str
[src]
Resolves a string by its key
Safety
Safety relies on the given Key
's adherence to symmetry, if the key gives bad indexes then it will cause UB,
With that in mind, never use any key not directly provided by the interner
Example
use lasso::{Cord, Key, Lasso}; let lasso = Lasso::default(); let key = lasso.intern("Strings of things with wings and dings"); let lasso = lasso.into_resolver(); assert_eq!("Strings of things with wings and dings", lasso.resolve(&key));
pub fn len(&self) -> usize
[src]
Gets the number of interned strings
Example
use lasso::Lasso; let lasso = Lasso::default(); lasso.intern("Documentation often has little hidden bits in it"); let lasso = lasso.into_resolver(); assert_eq!(lasso.len(), 1);
pub fn is_empty(&self) -> bool
[src]
Returns true
if there are no currently interned strings
Example
use lasso::Lasso; let lasso = Lasso::default(); let lasso = lasso.into_resolver(); assert!(lasso.is_empty());
Trait Implementations
impl<K: Key> Clone for ResolverLasso<K>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K: Debug + Key> Debug for ResolverLasso<K>
[src]
impl<K: Key> Drop for ResolverLasso<K>
[src]
Deallocate the leaked strings interned by ResolverLasso
impl<K: Key> Send for ResolverLasso<K>
[src]
impl<K: Key> Sync for ResolverLasso<K>
[src]
Auto Trait Implementations
impl<K> RefUnwindSafe for ResolverLasso<K> where
K: RefUnwindSafe,
K: RefUnwindSafe,
impl<K> Unpin for ResolverLasso<K> where
K: Unpin,
K: Unpin,
impl<K> UnwindSafe for ResolverLasso<K> where
K: UnwindSafe,
K: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,