From 57c53affe3542cb6bd4e79ee4c18f20a1bd76b2d Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 17 Aug 2026 05:49:19 +0800 Subject: 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. --- mingling_cli/src/pkg_mgr.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'mingling_cli/src/pkg_mgr.rs') 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 } -- cgit