Merge branch 'master' into copy-paste

This commit is contained in:
Antonio Scandurra
2021-04-14 12:05:52 +02:00
10 changed files with 102 additions and 84 deletions
+24 -16
View File
@@ -1499,14 +1499,6 @@ impl<'a, T: Entity> ModelContext<'a, T> {
}
}
pub fn app(&self) -> &AppContext {
&self.app.ctx
}
pub fn app_mut(&mut self) -> &mut MutableAppContext {
self.app
}
pub fn background_executor(&self) -> &Arc<executor::Background> {
&self.app.ctx.background
}
@@ -1644,6 +1636,18 @@ impl<'a, T: Entity> ModelContext<'a, T> {
}
}
impl<M> AsRef<AppContext> for ModelContext<'_, M> {
fn as_ref(&self) -> &AppContext {
&self.app.ctx
}
}
impl<M> AsMut<MutableAppContext> for ModelContext<'_, M> {
fn as_mut(&mut self) -> &mut MutableAppContext {
self.app
}
}
impl<M> ReadModel for ModelContext<'_, M> {
fn read_model<T: Entity>(&self, handle: &ModelHandle<T>) -> &T {
self.app.read_model(handle)
@@ -1689,14 +1693,6 @@ impl<'a, T: View> ViewContext<'a, T> {
self.window_id
}
pub fn app(&self) -> &AppContext {
&self.app.ctx
}
pub fn app_mut(&mut self) -> &mut MutableAppContext {
self.app
}
pub fn background_executor(&self) -> &Arc<executor::Background> {
&self.app.ctx.background
}
@@ -1899,6 +1895,18 @@ impl<'a, T: View> ViewContext<'a, T> {
}
}
impl<M> AsRef<AppContext> for ViewContext<'_, M> {
fn as_ref(&self) -> &AppContext {
&self.app.ctx
}
}
impl<M> AsMut<MutableAppContext> for ViewContext<'_, M> {
fn as_mut(&mut self) -> &mut MutableAppContext {
self.app
}
}
impl<V> ReadModel for ViewContext<'_, V> {
fn read_model<T: Entity>(&self, handle: &ModelHandle<T>) -> &T {
self.app.read_model(handle)