dashmap/setref/
one.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::mapref;
use core::hash::Hash;
use core::ops::Deref;

pub struct Ref<'a, K> {
    inner: mapref::one::Ref<'a, K, ()>,
}

impl<'a, K: Eq + Hash> Ref<'a, K> {
    pub(crate) fn new(inner: mapref::one::Ref<'a, K, ()>) -> Self {
        Self { inner }
    }

    pub fn key(&self) -> &K {
        self.inner.key()
    }
}

impl<'a, K: Eq + Hash> Deref for Ref<'a, K> {
    type Target = K;

    fn deref(&self) -> &K {
        self.key()
    }
}