Remove UpgradeModelHandle trait

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2023-04-24 16:40:30 +02:00
co-authored by Nathan Sobo
parent b8fab6fde9
commit 5f500d34b2
3 changed files with 60 additions and 144 deletions
+3 -21
View File
@@ -13,10 +13,9 @@ use crate::{
},
text_layout::TextLayoutCache,
util::post_inc,
Action, AnyModelHandle, AnyView, AnyViewHandle, AnyWeakModelHandle, AppContext,
BorrowAppContext, Effect, Element, Entity, Handle, ModelContext, ModelHandle, MouseRegion,
MouseRegionId, ParentId, SceneBuilder, Subscription, UpdateModel, UpdateView,
UpgradeModelHandle, View, ViewContext, ViewHandle, WeakModelHandle, WindowInvalidation,
Action, AnyView, AnyViewHandle, AppContext, BorrowAppContext, Effect, Element, Entity, Handle,
ModelContext, ModelHandle, MouseRegion, MouseRegionId, ParentId, SceneBuilder, Subscription,
UpdateModel, UpdateView, View, ViewContext, ViewHandle, WindowInvalidation,
};
use anyhow::{anyhow, bail, Result};
use collections::{HashMap, HashSet};
@@ -176,23 +175,6 @@ impl UpdateView for WindowContext<'_> {
}
}
impl UpgradeModelHandle for WindowContext<'_> {
fn upgrade_model_handle<T: Entity>(
&self,
handle: &WeakModelHandle<T>,
) -> Option<ModelHandle<T>> {
self.app_context.upgrade_model_handle(handle)
}
fn model_handle_is_upgradable<T: Entity>(&self, handle: &WeakModelHandle<T>) -> bool {
self.app_context.model_handle_is_upgradable(handle)
}
fn upgrade_any_model_handle(&self, handle: &AnyWeakModelHandle) -> Option<AnyModelHandle> {
self.app_context.upgrade_any_model_handle(handle)
}
}
impl<'a> WindowContext<'a> {
pub fn mutable(
app_context: &'a mut AppContext,