pub struct TypedInterner<T: Internable> { /* private fields */ }
Expand description

An interner for any type that implements Borrow. Not many optimizations are employed and the interner uses the default allocator. This and the use of weak references means that a long-lived instance can be kept around with regular calls to TypedInterner::sweep.

Implementations§

source§

impl<T: Internable> TypedInterner<T>

source

pub fn new() -> Arc<Self>

Create a fresh interner instance

source

pub fn size(self: &Arc<Self>) -> usize

Get the number of stored values

source

pub fn sweep(&self) -> usize

Remove entries which are no longer referenced anywhere else

source

pub fn i<Q>(self: &Arc<Self>, q: &Q) -> Tok<T>
where Q: ?Sized + Eq + Hash + ToOwned<Owned = T>, T: Borrow<Q>,

Intern an object, returning a token

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for TypedInterner<T>

§

impl<T> Send for TypedInterner<T>

§

impl<T> Sync for TypedInterner<T>

§

impl<T> Unpin for TypedInterner<T>

§

impl<T> UnwindSafe for TypedInterner<T>

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.