Take an Into<AnyViewHandle> in ChildView::new

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-01-27 17:52:36 +01:00
parent dbf48d2a5b
commit e7d4c385d5
12 changed files with 69 additions and 56 deletions

View file

@ -6,8 +6,8 @@ use crate::{
json::{self, ToJson},
platform::Event,
text_layout::TextLayoutCache,
Action, AnyAction, AssetCache, ElementBox, Entity, FontSystem, ModelHandle, ReadModel,
ReadView, Scene, View, ViewHandle,
Action, AnyAction, AnyViewHandle, AssetCache, ElementBox, Entity, FontSystem, ModelHandle,
ReadModel, ReadView, Scene, View, ViewHandle,
};
use pathfinder_geometry::vector::{vec2f, Vector2F};
use serde_json::json;
@ -462,8 +462,10 @@ pub struct ChildView {
}
impl ChildView {
pub fn new(view_id: usize) -> Self {
Self { view_id }
pub fn new(view: impl Into<AnyViewHandle>) -> Self {
Self {
view_id: view.into().id(),
}
}
}