summaryrefslogtreecommitdiffstats
path: root/third_party/rust/dashmap/src/setref/multiple.rs
blob: 21e7ed4a70f6d4b7763964db7ad6661f09d32704 (plain)
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::{BuildHasher, Hash};
use core::ops::Deref;
use std::collections::hash_map::RandomState;
pub struct RefMulti<'a, K, S = RandomState> {
    inner: mapref::multiple::RefMulti<'a, K, (), S>,
}

impl<'a, K: Eq + Hash, S: BuildHasher> RefMulti<'a, K, S> {
    pub(crate) fn new(inner: mapref::multiple::RefMulti<'a, K, (), S>) -> Self {
        Self { inner }
    }

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

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

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