This commit is contained in:
Antonio Scandurra 2023-10-22 18:01:00 +02:00
parent 50bbdd5cab
commit db6a3e1783
6 changed files with 174 additions and 126 deletions

View file

@ -153,16 +153,6 @@ pub trait BorrowAppContext {
result
}
fn with_global<T: Send + Sync + 'static, F, R>(&mut self, global: T, f: F) -> R
where
F: FnOnce(&mut Self) -> R,
{
self.app_mut().push_global(global);
let result = f(self);
self.app_mut().pop_global::<T>();
result
}
fn set_global<T: Send + Sync + 'static>(&mut self, global: T) {
self.app_mut().set_global(global)
}