Merge pull request #1 from marceline-cramer/master

Impl a better `Default` for Map
master
Avril 3 years ago committed by GitHub
commit ad94525f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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