Maintain search results as query and active editor changes

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-01-28 15:19:58 +01:00
parent 860e37d50f
commit 5c862bfe98
4 changed files with 69 additions and 8 deletions

View file

@ -3246,6 +3246,7 @@ impl Drop for AnyModelHandle {
self.ref_counts.lock().dec_model(self.model_id);
}
}
pub struct WeakViewHandle<T> {
window_id: usize,
view_id: usize,
@ -3288,6 +3289,21 @@ impl<T> Clone for WeakViewHandle<T> {
}
}
impl<T> PartialEq for WeakViewHandle<T> {
fn eq(&self, other: &Self) -> bool {
self.window_id == other.window_id && self.view_id == other.view_id
}
}
impl<T> Eq for WeakViewHandle<T> {}
impl<T> Hash for WeakViewHandle<T> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.window_id.hash(state);
self.view_id.hash(state);
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct ElementStateId(usize, usize);