refactor: wip

This commit is contained in:
GyDi
2022-11-15 01:33:50 +08:00
parent c8e6f3a627
commit ee68d80d0a
4 changed files with 77 additions and 40 deletions

View 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()
}
}