From e70ffc81399f0f90f71fd269f4ba2ee90ca20c4a Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 18 Aug 2026 02:23:13 +0800 Subject: chore!: simplify DirectoryEnvironmentSetup to unit struct Remove the generic parameter `C` from `DirectoryEnvironmentSetup`, making it a unit struct that no longer requires `::::default()` for construction. Update the `ProgramSetup` impl and the `setup` method signature accordingly, and improve the doc comments. --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c6b13..a3090b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -458,6 +458,25 @@ None 8. **[`Cargo.toml`]** Removed the legacy `extra_macros` feature alias from `mingling/Cargo.toml`. The `extras` feature (introduced in 0.4.0, BREAKING CHANGE #1) is now the sole name for this feature; the deprecated alias is gone. +9. **[`setups:dirs`]** **[BREAKING]** Simplified the `DirectoryEnvironmentSetup` type — it is no longer generic over the program collect type `C` and no longer requires `DirectoryEnvironmentSetup::::default()` to construct. + + ### What changed + + Previously, `DirectoryEnvironmentSetup` was a generic struct `DirectoryEnvironmentSetup` (carrying `PhantomData`) that had to be constructed via `DirectoryEnvironmentSetup::::default()` before calling `Program::with_setup`. Now the struct is unit-like (`pub struct DirectoryEnvironmentSetup;`), 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 + - **`DirectoryEnvironmentSetup`** → **`DirectoryEnvironmentSetup`** — The struct no longer has a generic parameter (previously `DirectoryEnvironmentSetup` with `PhantomData`). + - **`impl Default for DirectoryEnvironmentSetup`** — Removed. The unit struct uses the derived/implicit `Default`, and more importantly construction is now just the plain value `DirectoryEnvironmentSetup`, not `DirectoryEnvironmentSetup::::default()`. + - **`impl ProgramSetup for DirectoryEnvironmentSetup`** → **`impl ProgramSetup for DirectoryEnvironmentSetup`** — The `ProgramSetup` impl is now on the unit type. + + ### Migration guide + - Replace `program.with_setup(DirectoryEnvironmentSetup::::default())` with `program.with_setup(DirectoryEnvironmentSetup)`. + - Any type annotations referencing `DirectoryEnvironmentSetup` must drop the generic argument. + + _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. + --- ## Contents -- cgit