tree: implement pointer constraints
This commit is contained in:
parent
d4c4497043
commit
38d1267ec9
19 changed files with 707 additions and 4 deletions
|
|
@ -42,6 +42,10 @@ impl<K: Eq, V, const N: usize> SmallMap<K, V, N> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn contains(&self, k: &K) -> bool {
|
||||
unsafe { self.m.get().deref().contains(k) }
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
unsafe { self.m.get().deref().len() }
|
||||
}
|
||||
|
|
@ -158,6 +162,15 @@ impl<K: Eq, V, const N: usize> SmallMapMut<K, V, N> {
|
|||
self.m.len()
|
||||
}
|
||||
|
||||
pub fn contains(&self, k: &K) -> bool {
|
||||
for (ek, _) in &self.m {
|
||||
if ek == k {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, k: K, v: V) -> Option<V> {
|
||||
for (ek, ev) in &mut self.m {
|
||||
if ek == &k {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue