mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
refactor: wip
This commit is contained in:
20
src-tauri/src/config/config.rs
Normal file
20
src-tauri/src/config/config.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use super::{Draft, IVerge};
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
pub struct Config {
|
||||
verge_config: Draft<IVerge>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn global() -> &'static Config {
|
||||
static CONFIG: OnceCell<Config> = OnceCell::new();
|
||||
|
||||
CONFIG.get_or_init(|| Config {
|
||||
verge_config: Draft::from(IVerge::new()),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn verge() -> Draft<IVerge> {
|
||||
Self::global().verge_config.clone()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user