pub trait BorrowAppContext {
// Required methods
fn set_global<T: Global>(&mut self, global: T);
fn update_global<G, R>(
&mut self,
f: impl FnOnce(&mut G, &mut Self) -> R,
) -> R
where G: Global;
fn update_default_global<G, R>(
&mut self,
f: impl FnOnce(&mut G, &mut Self) -> R,
) -> R
where G: Global + Default;
}Expand description
A helper trait for auto-implementing certain methods on contexts that can be used interchangeably.
Required Methods§
Sourcefn set_global<T: Global>(&mut self, global: T)
fn set_global<T: Global>(&mut self, global: T)
Set a global value on the context.
Sourcefn update_global<G, R>(&mut self, f: impl FnOnce(&mut G, &mut Self) -> R) -> Rwhere
G: Global,
fn update_global<G, R>(&mut self, f: impl FnOnce(&mut G, &mut Self) -> R) -> Rwhere
G: Global,
Updates the global state of the given type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".