Browse Source

Impl a better Default for Map

master
marceline-cramer 3 months ago
parent
commit
f98a5fc042
  1. 10
      src/lib.rs

10
src/lib.rs

@ -210,7 +210,7 @@ where K: Collapse
}
/// A small hashtable-like map with byte sized key indecies.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature="serde", derive(serde::Serialize, serde::Deserialize))]
// TODO: Replace with `SmallVec<[Page<TKey, TValue>; 1]>` when feature that adds `smallvec` is enabled (this will allocate the first page on the stack, and the rest on the heap.
pub struct Map<TKey, TValue>(Vec<Page<TKey,TValue>>);
@ -449,6 +449,14 @@ where K: Collapse
}
}
impl<K: Collapse, V> Default for Map<K,V>
{
fn default() -> Self
{
Self::new()
}
}
impl<K: Collapse, V> IntoIterator for Map<K,V>
{
type Item= (K,V);

Loading…
Cancel
Save