From e8eea52d0f8c91f5e74c50181fd348f50bc13f62 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 31 Oct 2023 13:34:54 +0100 Subject: [PATCH] Allow WeakView to be hashed and compared --- crates/gpui2/src/view.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/gpui2/src/view.rs b/crates/gpui2/src/view.rs index dfc294bc05f0d3377791d6eb254e2ba9882a06ab..b54afa8dea03422cd81d4e5f9528639f6c6cd11f 100644 --- a/crates/gpui2/src/view.rs +++ b/crates/gpui2/src/view.rs @@ -178,6 +178,20 @@ impl Clone for WeakView { } } +impl Hash for WeakView { + fn hash(&self, state: &mut H) { + self.model.hash(state); + } +} + +impl PartialEq for WeakView { + fn eq(&self, other: &Self) -> bool { + self.model == other.model + } +} + +impl Eq for WeakView {} + struct EraseViewState { view: View, parent_view_state_type: PhantomData,