Remove one todo from the critical path
This commit is contained in:
parent
0ecf6bde73
commit
4da8ee1e1d
2 changed files with 84 additions and 67 deletions
|
@ -1993,6 +1993,23 @@ impl<V: 'static> WindowHandle<V> {
|
|||
state_type: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update<R>(
|
||||
&self,
|
||||
cx: &mut AppContext,
|
||||
update: impl FnOnce(&mut V, &mut ViewContext<V>) -> R,
|
||||
) -> Result<R> {
|
||||
cx.update_window(self.any_handle, |cx| {
|
||||
let root_view = cx
|
||||
.window
|
||||
.root_view
|
||||
.clone()
|
||||
.unwrap()
|
||||
.downcast::<V>()
|
||||
.unwrap();
|
||||
root_view.update(cx, update)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<V: 'static> Into<AnyWindowHandle> for WindowHandle<V> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue