[−][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> Serialize for Interner<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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,
T: RefUnwindSafe,
impl<T> Send for Interner<T> where
T: Send,
T: Send,
impl<T> Sync for Interner<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Interner<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Interner<T> where
T: RefUnwindSafe + UnwindSafe,
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,
fn borrow(&self) -> &TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
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.
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>,