use std::{borrow::Borrow, hash::Hash};
use dashmap::DashSet;
use crate::Map;
impl<K> Map for DashSet<K>
where
K: Eq + Hash + Send + Sync + 'static,
{
type Key = K;
type Val = ();
type RefVal<'a> = ();
fn clear(&self) {
self.clear();
}
fn insert(&self, key: Self::Key, _val: Self::Val) {
self.insert(key);
}
fn get<'a, Q>(&'a self, key: &Q) -> Option<Self::RefVal<'a>>
where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
{
if self.contains(key) { Some(()) } else { None }
}
}