pub trait UpdateGlobal {
// Required methods
fn update_global<C, F, R>(cx: &mut C, update: F) -> R
where C: BorrowAppContext,
F: FnOnce(&mut Self, &mut C) -> R;
fn set_global<C>(cx: &mut C, global: Self)
where C: BorrowAppContext;
}Expand description
A trait for updating a global value in the context.
Required Methods§
Sourcefn update_global<C, F, R>(cx: &mut C, update: F) -> R
fn update_global<C, F, R>(cx: &mut C, update: F) -> R
Updates the global instance of the implementing type using the provided closure.
This method provides the closure with mutable access to the context and the global simultaneously.
Sourcefn set_global<C>(cx: &mut C, global: Self)where
C: BorrowAppContext,
fn set_global<C>(cx: &mut C, global: Self)where
C: BorrowAppContext,
Set the global instance of the implementing type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".