[−][src]Struct scale_info::interner::Interner
Interning data structure generic over the element type.
For the sake of simplicity and correctness we are using a rather naive implementation.
Usage
This is used in order to quite efficiently cache strings and type definitions uniquely identified by their associated type identifiers.
Implementations
impl<T> Interner<T> where
T: Ord,
[src]
T: Ord,
impl<T> Interner<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
pub fn intern_or_get(&mut self, s: T) -> (bool, Symbol<'_, T>)
[src]
Interns the given element or returns its associated symbol if it has already been interned.
pub fn get(&self, s: &T) -> Option<Symbol<'_, T>>
[src]
Returns the symbol of the given element or None
if it hasn't been
interned already.
pub fn resolve(&self, sym: Symbol<'_, T>) -> Option<&T>
[src]
Resolves the original element given its associated symbol or
returns None
if it has not been interned yet.
Trait Implementations
impl<T: Debug> Debug for Interner<T>
[src]
impl<T: Ord> Default for Interner<T>
[src]
impl<T: Eq> Eq for Interner<T>
[src]
impl<T: PartialEq> PartialEq<Interner<T>> for Interner<T>
[src]
impl<T> StructuralEq for Interner<T>
[src]
impl<T> StructuralPartialEq for Interner<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Interner<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Interner<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Interner<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Interner<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Interner<T> where
T: RefUnwindSafe + UnwindSafe,
[src]
T: RefUnwindSafe + 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,
pub 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, 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.
pub 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>,