This commit is contained in:
Kirill Bulatov 2023-11-16 10:03:54 +02:00
parent e3465fbcf9
commit fd61683c46
13 changed files with 1174 additions and 1186 deletions

View file

@ -1830,8 +1830,8 @@ impl<'a, V: 'static> ViewContext<'a, V> {
self.view
}
pub fn model(&self) -> Model<V> {
self.view.model.clone()
pub fn model(&self) -> &Model<V> {
&self.view.model
}
/// Access the underlying window context.
@ -2163,7 +2163,7 @@ impl<'a, V: 'static> ViewContext<'a, V> {
pub fn observe_global<G: 'static>(
&mut self,
f: impl Fn(&mut V, &mut ViewContext<'_, V>) + 'static,
mut f: impl FnMut(&mut V, &mut ViewContext<'_, V>) + 'static,
) -> Subscription {
let window_handle = self.window.handle;
let view = self.view().downgrade();