Make production code compile again
This commit is contained in:
parent
bed94455b9
commit
38ab6b123f
22 changed files with 675 additions and 544 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::{
|
||||
any::Any,
|
||||
cell::RefCell,
|
||||
mem,
|
||||
path::PathBuf,
|
||||
|
@ -22,8 +23,8 @@ use crate::{
|
|||
platform,
|
||||
platform::{Event, InputHandler, KeyDownEvent, Platform},
|
||||
Action, AnyViewHandle, AppContext, Entity, FontCache, Handle, ModelContext, ModelHandle,
|
||||
ReadModelWith, ReadViewWith, Task, UpdateModel, UpdateView, View, ViewContext, ViewHandle,
|
||||
WeakHandle, WindowContext,
|
||||
ReadModelWith, ReadViewWith, Subscription, Task, UpdateModel, UpdateView, View, ViewContext,
|
||||
ViewHandle, WeakHandle, WindowContext,
|
||||
};
|
||||
use collections::BTreeMap;
|
||||
|
||||
|
@ -160,6 +161,26 @@ impl TestAppContext {
|
|||
self.cx.borrow_mut().add_view(parent_handle, build_view)
|
||||
}
|
||||
|
||||
pub fn observe_global<E, F>(&mut self, callback: F) -> Subscription
|
||||
where
|
||||
E: Any,
|
||||
F: 'static + FnMut(&mut AppContext),
|
||||
{
|
||||
self.cx.borrow_mut().observe_global::<E, F>(callback)
|
||||
}
|
||||
|
||||
pub fn set_global<T: 'static>(&mut self, state: T) {
|
||||
self.cx.borrow_mut().set_global(state);
|
||||
}
|
||||
|
||||
pub fn subscribe_global<E, F>(&mut self, callback: F) -> Subscription
|
||||
where
|
||||
E: Any,
|
||||
F: 'static + FnMut(&E, &mut AppContext),
|
||||
{
|
||||
self.cx.borrow_mut().subscribe_global(callback)
|
||||
}
|
||||
|
||||
pub fn window_ids(&self) -> Vec<usize> {
|
||||
self.cx.borrow().window_ids().collect()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue