pub fn intern<Q>(&self, value: Q, make: impl FnOnce(Q) -> Interned<'a, T>) -> Interned<'a, T>
    where
        Interned<'a, T>: Borrow<Q>,
        Q: Hash + Eq,
    {
        let hash = make_hash(&value);
        let mut map = self.map.borrow_mut();
        let entry = map.raw_entry_mut().from_key_hashed_nocheck(hash, &value);

        match entry {
            RawEntryMut::Occupied(e) => *e.key(),
            RawEntryMut::Vacant(e) => {
                let v = make(value);
                e.insert_hashed_nocheck(hash, v, ());
                v
            }
        }
    }
/// Intern a value.
///
/// Tip: To intern things, you probably want to use the functions provided
/// on [`ctxt::Interners`][crate::ctxt::Interners].
///
/// This function is taken nearly verbatim from rustc, with some simplification.
Intern a value.

This function is taken nearly verbatim from rustc, with some simplification.
Intern a value . This function is taken nearly verbatim from rustc with some simplification .
pub fn intern<Q>(&self, value: Q, make: impl FnOnce(Q) -> Interned<'a, T>) -> Interned<'a, T>
    where
        Interned<'a, T>: Borrow<Q>,
        Q: Hash + Eq,
    {
        let hash = make_hash(&value);
        let mut map = self.map.borrow_mut();
        let entry = map.raw_entry_mut().from_key_hashed_nocheck(hash, &value);
        match entry {
            RawEntryMut::Occupied(e) => *e.key(),
            RawEntryMut::Vacant(e) => {
                let v = make(value);
                e.insert_hashed_nocheck(hash, v, ());
                v
            }
        }
    }
pub fn intern < Q > ( & self , value : Q , make : impl FnOnce ( Q ) -> Interned < ' a , T > ) -> Interned < ' a , T > where Interned < ' a , T > : Borrow < Q > , Q : Hash + Eq , { let hash = make_hash ( & value ) ; let mut map = self . map . borrow_mut ( ) ; let entry = map . raw_entry_mut ( ) . from_key_hashed_nocheck ( hash , & value ) ; match entry { RawEntryMut :: Occupied ( e ) => * e . key ( ) , RawEntryMut :: Vacant ( e ) => { let v = make ( value ) ; e . insert_hashed_nocheck ( hash , v , ( ) ) ; v } } }
Intern a value.
Intern a value .
&self
value
Q
make
impl FnOnce(Q) -> Interned<'a, T>
&self
value
Q
make
impl FnOnce(Q) -> Interned<'a, T>