Return window handles from WeakItemHandle

This commit is contained in:
Nathan Sobo 2023-08-08 11:39:56 -06:00
parent b2d9ccc0a2
commit b77c336a3d
2 changed files with 5 additions and 5 deletions

View File

@ -281,7 +281,7 @@ pub trait ItemHandle: 'static + fmt::Debug {
pub trait WeakItemHandle {
fn id(&self) -> usize;
fn window_id(&self) -> usize;
fn window(&self) -> AnyWindowHandle;
fn upgrade(&self, cx: &AppContext) -> Option<Box<dyn ItemHandle>>;
}
@ -650,8 +650,8 @@ impl<T: Item> WeakItemHandle for WeakViewHandle<T> {
self.id()
}
fn window_id(&self) -> usize {
self.window_id()
fn window(&self) -> AnyWindowHandle {
self.window()
}
fn upgrade(&self, cx: &AppContext) -> Option<Box<dyn ItemHandle>> {

View File

@ -259,7 +259,7 @@ impl<T: SearchableItem> WeakSearchableItemHandle for WeakViewHandle<T> {
impl PartialEq for Box<dyn WeakSearchableItemHandle> {
fn eq(&self, other: &Self) -> bool {
self.id() == other.id() && self.window_id() == other.window_id()
self.id() == other.id() && self.window() == other.window()
}
}
@ -267,6 +267,6 @@ impl Eq for Box<dyn WeakSearchableItemHandle> {}
impl std::hash::Hash for Box<dyn WeakSearchableItemHandle> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
(self.id(), self.window_id()).hash(state)
(self.id(), self.window().id()).hash(state)
}
}