feat: 支持调整程序内存中暂存的显示器配置。

This commit is contained in:
2023-05-07 14:32:31 +08:00
parent 3a430716d6
commit 239144a446
7 changed files with 155 additions and 28 deletions

View 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,
}
}
}