From cd9cad77542e1909f9600f8a2e2754cc4cc4507a Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 18 Aug 2026 02:30:09 +0800 Subject: chore!: simplify ExitCodeSetup to non-generic unit struct --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index a3090b4..e216f6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -477,6 +477,25 @@ None _No behavioral changes — the setup still registers the same four directory resources (`ResCurrentDir`, `ResCurrentExe`, `ResHomeDir`, `ResTempDir`) in the program's resource store. The type simplification is purely ergonomic. +10. **[`setups:exit_code`]** **[BREAKING]** Simplified the `ExitCodeSetup` type — it is no longer generic over the program collect type `C` and no longer requires `ExitCodeSetup::::default()` to construct. + + ### What changed + + Previously, `ExitCodeSetup` was a generic struct `ExitCodeSetup` (carrying `PhantomData`) that had to be constructed via `ExitCodeSetup::::default()` before calling `Program::with_setup`. Now the struct is unit-like (`pub struct ExitCodeSetup;`), so it can be constructed directly as a value with no `::default()` call and no generic parameter. + + Additionally, the `setup` method's `program` parameter was retyped from `crate::Program` to `mingling_core::Program` for cleanliness. + + ### Removed / changed API + - **`ExitCodeSetup`** → **`ExitCodeSetup`** — The struct no longer has a generic parameter (previously `ExitCodeSetup` with `PhantomData`). + - **`impl Default for ExitCodeSetup`** — Removed. The unit struct uses the derived/implicit `Default`, and more importantly construction is now just the plain value `ExitCodeSetup`, not `ExitCodeSetup::::default()`. + - **`impl ProgramSetup for ExitCodeSetup`** → **`impl ProgramSetup for ExitCodeSetup`** — The `ProgramSetup` impl is now on the unit type. + + ### Migration guide + - Replace `program.with_setup(ExitCodeSetup::::default())` (or `ExitCodeSetup::default()`) with `program.with_setup(ExitCodeSetup)`. + - Any type annotations referencing `ExitCodeSetup` must drop the generic argument. + + _No behavioral changes — the setup still registers the same `ResExitCode` resource (initialised to `0`) and installs the same program-finish hook that overrides the program's exit code when the resource holds a non-zero value. The type simplification is purely ergonomic._ + --- ## Contents -- cgit