pub trait ReadGlobal {
// Required method
fn global(cx: &App) -> &Self;
}Expand description
Reads the global of the implementing type from an App, as in Theme::global(cx).
Every Global type implements this trait. Use it to name a global by type instead of calling
App::global with a turbofish.
§Examples
struct Theme {
dark: bool,
}
impl Global for Theme {}
app.set_global(Theme { dark: true });
assert!(app.read(|cx| Theme::global(cx).dark));Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".