mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
fix: silent start does not take effect (#3708)
* fix: light mode error * feat: optimize the logic * fix: clippy issues
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
use std::sync::Once;
|
||||
use std::sync::{Arc, Once, OnceLock};
|
||||
|
||||
use crate::{logging, utils::logging::Type};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LightWeightState {
|
||||
#[allow(unused)]
|
||||
once: Once,
|
||||
once: Arc<Once>,
|
||||
pub is_lightweight: bool,
|
||||
}
|
||||
|
||||
impl LightWeightState {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
once: Once::new(),
|
||||
once: Arc::new(Once::new()),
|
||||
is_lightweight: false,
|
||||
}
|
||||
}
|
||||
@@ -37,6 +38,7 @@ impl LightWeightState {
|
||||
|
||||
impl Default for LightWeightState {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
static INSTANCE: OnceLock<LightWeightState> = OnceLock::new();
|
||||
INSTANCE.get_or_init(LightWeightState::new).clone()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user