refactor: migrate from serde_yaml to serde_yaml_ng for improved YAML handling (#4568)

* refactor: migrate from serde_yaml to serde_yaml_ng for improved YAML handling

* refactor: format code for better readability in DNS configuration
This commit is contained in:
Tunglies
2025-08-30 02:24:47 +08:00
committed by GitHub
parent f86a1816e0
commit 3939741a06
24 changed files with 70 additions and 50 deletions

View File

@@ -1,6 +1,6 @@
use super::use_lowercase;
use anyhow::{Error, Result};
use serde_yaml::Mapping;
use serde_yaml_ng::Mapping;
pub fn use_script(
script: String,
@@ -149,11 +149,11 @@ fn test_script() {
enable: false
";
let config = serde_yaml::from_str(config).expect("Failed to parse test config YAML");
let config = serde_yaml_ng::from_str(config).expect("Failed to parse test config YAML");
let (config, results) = use_script(script.into(), config, "".to_string())
.expect("Script execution should succeed in test");
let _ = serde_yaml::to_string(&config).expect("Failed to serialize config to YAML");
let _ = serde_yaml_ng::to_string(&config).expect("Failed to serialize config to YAML");
let yaml_config_size = std::mem::size_of_val(&config);
let box_yaml_config_size = std::mem::size_of_val(&Box::new(config));
assert!(box_yaml_config_size < yaml_config_size);