From 514357b74e66c3eb626ca51a818c816a82ffc85f Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 23 Jun 2026 01:03:42 +0800 Subject: Add aliased syntax to `group!` macro Allow `group!(Alias = TypePath)` to create a type alias and use the alias name as the enum variant, enabling more descriptive naming --- CHANGELOG.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index b074be6..e9bb4d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -197,10 +197,19 @@ This macro is only available with the `extra_macros` feature. 9. **\[mingling\]** Added `Groupped` trait to the `mingling::prelude` module, so it can now be imported via `use mingling::prelude::*` without needing to separately import the trait from the `mingling` crate root. -10. **\[macros\]** Added the `group!` macro for registering outside-types from external crates as group members without modifying their definitions. This macro generates a `Groupped` implementation and registers the type's simple name as an enum variant. +10. **\[macros:group\]** Added the `group!` macro for registering outside-types from external crates as group members without modifying their definitions. This macro generates a `Groupped` implementation and registers the type's simple name as an enum variant. + +Uses the type's last path segment as the enum variant name: + +```rust,ignore +group!(std::io::Error); // registers as `Error` variant +``` + +An aliased syntax is also supported for descriptive variant naming: ```rust,ignore -group!(std::io::Error); +// registers as `IoError` variant, creates `pub type IoError = std::io::Error;` +group!(IoError = std::io::Error); ``` This macro is only available with the `extra_macros` feature. -- cgit