Support setting referent properties via attributes (#843)

Co-authored-by: Kenneth Loeffler <kenloef@gmail.com>
This commit is contained in:
Micah
2024-06-20 15:48:52 -07:00
committed by GitHub
parent a7b45ee859
commit 7e2bab921a
64 changed files with 942 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
use std::{
borrow::Borrow,
collections::HashMap,
collections::{hash_map, HashMap},
fmt::{self, Debug},
hash::Hash,
};
@@ -71,3 +71,33 @@ impl<K: Hash + Eq, V: Eq> PartialEq for MultiMap<K, V> {
self.inner == other.inner
}
}
impl<K, V> Default for MultiMap<K, V> {
fn default() -> Self {
Self {
inner: Default::default(),
}
}
}
impl<K: Hash + Eq, V: Eq> IntoIterator for MultiMap<K, V> {
type IntoIter = MultiMapIntoIter<K, V>;
type Item = (K, Vec<V>);
fn into_iter(self) -> Self::IntoIter {
Self::IntoIter {
inner: self.inner.into_iter(),
}
}
}
pub struct MultiMapIntoIter<K: Hash + Eq, V: Eq> {
inner: hash_map::IntoIter<K, Vec<V>>,
}
impl<K: Hash + Eq, V: Eq> Iterator for MultiMapIntoIter<K, V> {
type Item = (K, Vec<V>);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}