https://github.com/huacnlee/gpui-component/assets/5518/51622a5e-f51d-4ede-8cae-04cae703f8aa
15 lines
278 B
Rust
15 lines
278 B
Rust
use std::sync::Weak;
|
|
|
|
use gpui::{AppContext, Global};
|
|
|
|
pub struct AppState {}
|
|
|
|
struct GlobalAppState();
|
|
|
|
impl Global for GlobalAppState {}
|
|
|
|
impl AppState {
|
|
pub fn set_global(_app_state: Weak<AppState>, cx: &mut AppContext) {
|
|
cx.set_global(GlobalAppState());
|
|
}
|
|
}
|