Allow WeakView<T> to be hashed and compared

This commit is contained in:
Antonio Scandurra
2023-10-31 13:34:54 +01:00
parent 46a99c5c41
commit e8eea52d0f
+14
View File
@@ -178,6 +178,20 @@ impl<V> Clone for WeakView<V> {
}
}
impl<V> Hash for WeakView<V> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.model.hash(state);
}
}
impl<V> PartialEq for WeakView<V> {
fn eq(&self, other: &Self) -> bool {
self.model == other.model
}
}
impl<V> Eq for WeakView<V> {}
struct EraseViewState<V, ParentV> {
view: View<V>,
parent_view_state_type: PhantomData<ParentV>,