diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-17 05:49:19 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-17 05:49:19 +0800 |
| commit | 57c53affe3542cb6bd4e79ee4c18f20a1bd76b2d (patch) | |
| tree | 1cd4aef44cb7a45a8cd9d520b598f5f181e24c76 /mingling_cli/src/pkg_mgr.rs | |
| parent | ef23cd944402939605c78a4a853ef6e33af02c21 (diff) | |
refactor!: replace pack! macros with derive-based pipeline types
Remove the `pack!`, `pack_err!`, `pack_structural!`, and
`pack_err_structural!` macros, replacing all pipeline type definitions
with `#[derive(Grouped)]` and `#[derive(Grouped, Wrap)]` attributes.
This changes the generated struct shape from named-field structs with an
`inner` field to tuple structs accessed via `.0`, and removes the
auto-generated `name` and `info` fields from error types.
Diffstat (limited to 'mingling_cli/src/pkg_mgr.rs')
| -rw-r--r-- | mingling_cli/src/pkg_mgr.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/mingling_cli/src/pkg_mgr.rs b/mingling_cli/src/pkg_mgr.rs index e140991..8493804 100644 --- a/mingling_cli/src/pkg_mgr.rs +++ b/mingling_cli/src/pkg_mgr.rs @@ -8,16 +8,23 @@ pub mod cmd_uninstall; use std::path::PathBuf; use mingling::{ - Program, RenderResult, - macros::{pack_err, program_setup, r_println, renderer}, + Grouped, Program, RenderResult, Wrap, + macros::{program_setup, r_println, renderer}, }; use crate::{ThisProgram, eprintln_cargo, hprintln_cargo}; -pack_err!(ErrorRootPackageNotFound); -pack_err!(ErrorNoDataDirectory); -pack_err!(ErrorPackageSpecInvalid = String); -pack_err!(ErrorPackageNameRequired); +#[derive(Grouped, Default)] +pub struct ErrorRootPackageNotFound; + +#[derive(Grouped, Default)] +pub struct ErrorNoDataDirectory; + +#[derive(Grouped, Wrap)] +pub struct ErrorPackageSpecInvalid(String); + +#[derive(Grouped, Default)] +pub struct ErrorPackageNameRequired; /// The `mingling/packages` packages directory under the user's data directory. #[derive(Debug, Default, Clone)] @@ -55,7 +62,7 @@ pub fn render_error_no_data_directory(_: ErrorNoDataDirectory) -> RenderResult { #[renderer] pub fn render_error_package_spec_invalid(err: ErrorPackageSpecInvalid) -> RenderResult { let mut r = RenderResult::new(); - eprintln_cargo!(r, "invalid package spec: {}", err.info); + eprintln_cargo!(r, "invalid package spec: {}", err.0); r } |
