pub struct Interner { /* private fields */ }
Expand description

A collection of interners based on their type. Can be used to intern any object that implements ToOwned. Objects of the same type are stored together in a TypedInterner

Implementations§

source§

impl Interner

source

pub fn new() -> Self

Create a new interner

source

pub fn i<Q>(&self, q: &Q) -> Tok<Q::Owned>
where Q: ?Sized + Eq + Hash + ToOwned, Q::Owned: 'static + Eq + Hash + Clone + Borrow<Q> + Send + Sync,

Intern something

source

pub fn sweep_t<T: Eq + Hash + Clone + Send + Sync + 'static>(&self) -> usize

Sweep values of a specific type. Useful if you just constructed a large number of values of a specific type, otherwise use Interner::sweep

source

pub fn sweep(&self) -> usize

Sweep all values not referenced by anything other than the interner.

source

pub fn iv<T: 'static + Eq + Hash + Clone + Sync + Send>( &self, s: impl IntoIterator<Item = T> ) -> Tok<Vec<Tok<T>>>

Intern a list and its elements. See also Interner::ibv

source

pub fn ibv<'a, Q>( &self, s: impl IntoIterator<Item = &'a Q> ) -> Tok<Vec<Tok<Q::Owned>>>
where Q: ?Sized + Eq + Hash + ToOwned + 'a, Q::Owned: Eq + Hash + Clone + Send + Sync,

Intern a list of borrowed items. See also Interner::iv

Trait Implementations§

source§

impl Default for Interner

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.