chore: 初始化项目基础结构和资源文件
- 添加项目图标文件(app-icon.png、各平台图标) - 配置开发环境文件(.env、.nvmrc、.npmrc) - 添加静态资源文件(背景图片、字体、音频) - 初始化Tauri后端结构(build.rs、main.rs、模块文件) - 配置前端项目结构(TypeScript、Vue组件、样式) - 添加Node.js API服务基础结构 - 配置构建和开发工具(vite、prettier、gitignore)
This commit is contained in:
60
src-tauri/src/window/label.rs
Normal file
60
src-tauri/src/window/label.rs
Normal file
@ -0,0 +1,60 @@
|
||||
//! 窗口标签定义模块
|
||||
//!
|
||||
//! 提供窗口标签的类型安全常量,避免硬编码字符串。
|
||||
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
/// 窗口标签类型
|
||||
///
|
||||
/// 提供类型安全的窗口标签常量,避免使用魔法字符串
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct WindowLabel(&'static str);
|
||||
|
||||
impl WindowLabel {
|
||||
/// 主窗口
|
||||
pub const MAIN: Self = Self("main");
|
||||
/// 悬浮列表窗口
|
||||
pub const FLOAT_LIST: Self = Self("float-list");
|
||||
/// 弹出框窗口
|
||||
pub const POPUP: Self = Self("popup");
|
||||
/// 画板窗口
|
||||
pub const DRAWING_BOARD: Self = Self("drawing-board");
|
||||
/// 实时字幕窗口
|
||||
pub const SUBTITLE: Self = Self("subtitle");
|
||||
/// 会议窗口
|
||||
pub const MEETING: Self = Self("meeting");
|
||||
/// 会议窗口2
|
||||
pub const MEETING2: Self = Self("meeting2");
|
||||
/// 系统托盘
|
||||
pub const MAIN_TRAY: Self = Self("main");
|
||||
}
|
||||
|
||||
impl Display for WindowLabel {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<str> for WindowLabel {
|
||||
fn as_ref(&self) -> &str {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<WindowLabel> for String {
|
||||
fn from(label: WindowLabel) -> Self {
|
||||
label.0.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<WindowLabel> for &'static str {
|
||||
fn from(label: WindowLabel) -> Self {
|
||||
label.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a WindowLabel> for &'a str {
|
||||
fn from(label: &'a WindowLabel) -> Self {
|
||||
label.0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user