feat: 支持调整程序内存中暂存的显示器配置。
This commit is contained in:
26
src-tauri/src/rpc/channels.rs
Normal file
26
src-tauri/src/rpc/channels.rs
Normal file
@ -0,0 +1,26 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use tokio::sync::{broadcast, OnceCell};
|
||||
|
||||
use super::DisplaySettingRequest;
|
||||
|
||||
pub struct BoardMessageChannels {
|
||||
pub display_setting_request_sender: Arc<broadcast::Sender<DisplaySettingRequest>>,
|
||||
}
|
||||
|
||||
impl BoardMessageChannels {
|
||||
pub async fn global() -> &'static Self {
|
||||
static BOARD_MESSAGE_CHANNELS: OnceCell<BoardMessageChannels> = OnceCell::const_new();
|
||||
|
||||
BOARD_MESSAGE_CHANNELS.get_or_init(|| async {Self::new()}).await
|
||||
}
|
||||
|
||||
pub fn new() -> Self {
|
||||
let (display_setting_request_sender, _) = broadcast::channel(16);
|
||||
let display_setting_request_sender = Arc::new(display_setting_request_sender);
|
||||
|
||||
Self {
|
||||
display_setting_request_sender,
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user