refactor(state/proxy): use Box<Value> for providers_proxies to reduce struct size

- Changed providers_proxies from Value to Box<Value> in CmdProxyState
- Reduces struct size from 32 bytes to 8 bytes, optimizing memory usage
This commit is contained in:
Tunglies
2025-06-06 12:46:58 +08:00
parent 698c47da69
commit 30015dfd67
2 changed files with 10 additions and 8 deletions

View File

@@ -1,8 +1,10 @@
use serde_json::Value;
pub struct CmdProxyState {
pub last_refresh_time: std::time::Instant,
pub need_refresh: bool,
pub proxies: serde_json::Value,
pub providers_proxies: serde_json::Value,
pub proxies: Box<Value>,
pub providers_proxies: Box<Value>,
}
impl Default for CmdProxyState {
@@ -10,8 +12,8 @@ impl Default for CmdProxyState {
Self {
last_refresh_time: std::time::Instant::now(),
need_refresh: true,
proxies: serde_json::Value::Null,
providers_proxies: serde_json::Value::Null,
proxies: Box::new(Value::Null),
providers_proxies: Box::new(Value::Null),
}
}
}