use super::{Draft, IClashTemp, IProfiles, IVerge}; use once_cell::sync::OnceCell; pub struct Config { clash_config: Draft, verge_config: Draft, profiles_config: Draft, } impl Config { pub fn global() -> &'static Config { static CONFIG: OnceCell = OnceCell::new(); CONFIG.get_or_init(|| Config { clash_config: Draft::from(IClashTemp::new()), verge_config: Draft::from(IVerge::new()), profiles_config: Draft::from(IProfiles::new()), }) } pub fn clash() -> Draft { Self::global().clash_config.clone() } pub fn verge() -> Draft { Self::global().verge_config.clone() } pub fn profiles() -> Draft { Self::global().profiles_config.clone() } }