Make WrapMap and DisplayMap models

This removes the need for a lock around in `WrapMap` and also removes
`WrapMap::notifications` because gpui already has a standard way of
notifying when a model updates.
This commit is contained in:
Antonio Scandurra
2021-07-26 13:02:31 +02:00
parent b04c5741aa
commit b647e3ee71
4 changed files with 246 additions and 192 deletions
+14
View File
@@ -1850,6 +1850,20 @@ impl<M> UpdateModel for ModelContext<'_, M> {
}
}
impl<M> Deref for ModelContext<'_, M> {
type Target = MutableAppContext;
fn deref(&self) -> &Self::Target {
&self.app
}
}
impl<M> DerefMut for ModelContext<'_, M> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.app
}
}
pub struct ViewContext<'a, T: ?Sized> {
app: &'a mut MutableAppContext,
window_id: usize,