data_structure_traits/
set.rs

1use core::borrow::Borrow;
2
3use super::{Collection, Get};
4
5pub trait Set<'a, V, Q>: Collection + Get<&'a Q, Output = V>
6where
7    V: 'a + ?Sized + Borrow<Q>,
8    Q: 'a + ?Sized,
9{
10    #[inline(always)]
11    fn contains(&self, q: &'a Q) -> bool {
12        self.get(q).is_some()
13    }
14}
15
16impl<'a, V, Q, T> Set<'a, V, Q> for T
17where
18    T: 'a + Collection + Get<&'a Q, Output = V>,
19    V: 'a + ?Sized + Borrow<Q>,
20    Q: 'a + ?Sized,
21{}