diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-03 14:46:37 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-03 14:48:59 +0800 |
| commit | 0ddfcbd044aa2a35f716f8d9b18c056dd6ec46af (patch) | |
| tree | 4b26fa053cea41ef730c0da72f1d796ac785ef0f /mingling/src/setups/picker/structural_renderer.rs | |
| parent | 52a448ca246d60f4cf88bdcde73bfed0f989c848 (diff) | |
refactor(picker): replace global picker functions with PickerHelper
trait
Diffstat (limited to 'mingling/src/setups/picker/structural_renderer.rs')
| -rw-r--r-- | mingling/src/setups/picker/structural_renderer.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/mingling/src/setups/picker/structural_renderer.rs b/mingling/src/setups/picker/structural_renderer.rs index 1fa48fd..91848e4 100644 --- a/mingling/src/setups/picker/structural_renderer.rs +++ b/mingling/src/setups/picker/structural_renderer.rs @@ -1,9 +1,6 @@ use mingling_core::{Program, ProgramCollect, setup::ProgramSetup}; -use crate::{ - consts::RENDERER_ARG, - picker::{pick_global_argument, pick_global_flag}, -}; +use crate::{consts::RENDERER_ARG, picker::PickerHelper}; /// Sets up the structural renderer for the program: /// @@ -15,7 +12,7 @@ where C: ProgramCollect<Enum = C>, { fn setup(self, program: &mut Program<C>) { - if let Some(renderer) = pick_global_argument(program, &RENDERER_ARG) { + if let Some(renderer) = program.pick_argument(&RENDERER_ARG) { program.structural_renderer_name = renderer.into(); } } @@ -49,27 +46,27 @@ where { fn setup(self, program: &mut Program<C>) { #[cfg(feature = "json_serde_fmt")] - if pick_global_flag(program, &crate::consts::JSON_FLAG) { + if program.pick_flag(&crate::consts::JSON_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::Json; } #[cfg(feature = "json_serde_fmt")] - if pick_global_flag(program, &crate::consts::JSON_PRETTY_FLAG) { + if program.pick_flag(&crate::consts::JSON_PRETTY_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::JsonPretty; } #[cfg(feature = "yaml_serde_fmt")] - if pick_global_flag(program, &crate::consts::YAML_FLAG) { + if program.pick_flag(&crate::consts::YAML_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::Yaml; } #[cfg(feature = "toml_serde_fmt")] - if pick_global_flag(program, &crate::consts::TOML_FLAG) { + if program.pick_flag(&crate::consts::TOML_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::Toml; } #[cfg(feature = "ron_serde_fmt")] - if pick_global_flag(program, &crate::consts::RON_FLAG) { + if program.pick_flag(&crate::consts::RON_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::Ron; } #[cfg(feature = "ron_serde_fmt")] - if pick_global_flag(program, &crate::consts::RON_PRETTY_FLAG) { + if program.pick_flag(&crate::consts::RON_PRETTY_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::RonPretty; } } |
