From 353fdc5b539aae0479c7404d0ed6404f82bf633a Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 27 Jun 2026 18:52:49 +0800 Subject: feat(mingling): add directory environment resources and setup Add four new resource types for common directory paths and a convenience setup struct that registers all of them at once. --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cc4e6f..066cc5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -530,6 +530,23 @@ dispatcher! { } ``` +10. **\[mingling\]** Added the `DirectoryEnvironmentSetup` setup struct, which registers four common directory-based resources (`ResCurrentDir`, `ResCurrentExe`, `ResHomeDir`, `ResTempDir`) in a single call. These resources provide convenient access to the current working directory, the executable's path, the user's home directory, and the system temporary directory, respectively. + +```rust +use mingling::setups::DirectoryEnvironmentSetup; + +program.with_setup(DirectoryEnvironmentSetup::::default()); +``` + +11. **\[mingling\]** Added four new resource types for directory environments: + + - `ResCurrentDir` — Wraps `std::env::current_dir()` as a global resource. Provides `new() -> Result`, `Default` (panics on failure), and conversions from/to `PathBuf`, `&Path`, and `&PathBuf`. + - `ResCurrentExe` — Wraps `std::env::current_exe()` as a global resource. Provides `new() -> Result`, `Default` (panics on failure), and conversions from/to `PathBuf`, `&Path`, and `&PathBuf`. + - `ResHomeDir` — Wraps the user's home directory (`$HOME` on Unix, `%USERPROFILE%` on Windows) as a global resource. Provides `new() -> Result`, `Default` (panics on failure), and conversions from/to `PathBuf`, `&Path`, and `&PathBuf`. + - `ResTempDir` — Wraps `std::env::temp_dir()` as a global resource. Provides `new()` (infallible), `Default`, and conversions from/to `PathBuf`, `&Path`, and `&PathBuf`. + + All four types implement `Deref`, `DerefMut`, `AsRef`, `Clone`, `Debug`, and `PartialEq`. + #### **BREAKING CHANGES** (API CHANGES): 1. **\[core\]** Panic Unwind will not be supported when the `async` feature is enabled -- cgit