mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
- Refactored config-related structs to use Box for storing large objects (e.g., IRuntime, IProfiles, PrfItem) to reduce stack memory usage and improve performance. - Updated related methods and assignments to handle Boxed types correctly. - Added and improved unit tests to compare memory usage between Boxed and non-Boxed config objects, demonstrating the memory efficiency of Box. - Test output now shows the size difference between stack-allocated and heap-allocated (Box) config objects.
17 lines
442 B
Rust
17 lines
442 B
Rust
use super::CmdResult;
|
|
use crate::{config::*, feat, wrap_err};
|
|
|
|
/// 获取Verge配置
|
|
#[tauri::command]
|
|
pub fn get_verge_config() -> CmdResult<IVergeResponse> {
|
|
let verge = Config::verge();
|
|
let verge_data = verge.data().clone();
|
|
Ok(IVergeResponse::from(*verge_data))
|
|
}
|
|
|
|
/// 修改Verge配置
|
|
#[tauri::command]
|
|
pub async fn patch_verge_config(payload: IVerge) -> CmdResult {
|
|
wrap_err!(feat::patch_verge(payload, false).await)
|
|
}
|