perf: change patch_config parameter from Mapping to &Mapping for efficiency

This commit is contained in:
Tunglies
2025-11-30 20:44:21 +08:00
parent ae8c302bf4
commit 6897ead070
5 changed files with 19 additions and 20 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ pub async fn change_clash_mode(mode: String) {
// 更新订阅
Config::clash()
.await
.edit_draft(|d| d.patch_config(mapping));
.edit_draft(|d| d.patch_config(&mapping));
// 分离数据获取和异步调用
let clash_data = Config::clash().await.data_arc();
+2 -4
View File
@@ -9,10 +9,8 @@ use clash_verge_logging::{Type, logging, logging_error};
use serde_yaml_ng::Mapping;
/// Patch Clash configuration
pub async fn patch_clash(patch: Mapping) -> Result<()> {
Config::clash()
.await
.edit_draft(|d| d.patch_config(patch.clone()));
pub async fn patch_clash(patch: &Mapping) -> Result<()> {
Config::clash().await.edit_draft(|d| d.patch_config(patch));
let res = {
// 激活订阅