1 use crate::mapref; 2 use core::hash::{BuildHasher, Hash}; 3 use core::ops::Deref; 4 use std::collections::hash_map::RandomState; 5 pub struct Ref<'a, K, S = RandomState> { 6 inner: mapref::one::Ref<'a, K, (), S>, 7 } 8 9 impl<'a, K: Eq + Hash, S: BuildHasher> Ref<'a, K, S> { new(inner: mapref::one::Ref<'a, K, (), S>) -> Self10 pub(crate) fn new(inner: mapref::one::Ref<'a, K, (), S>) -> Self { 11 Self { inner } 12 } 13 key(&self) -> &K14 pub fn key(&self) -> &K { 15 self.inner.key() 16 } 17 } 18 19 impl<'a, K: Eq + Hash, S: BuildHasher> Deref for Ref<'a, K, S> { 20 type Target = K; 21 deref(&self) -> &K22 fn deref(&self) -> &K { 23 self.key() 24 } 25 } 26