diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-23 01:03:42 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-23 01:03:42 +0800 |
| commit | 514357b74e66c3eb626ca51a818c816a82ffc85f (patch) | |
| tree | f29e15b15d640a23c7db48c64e69f452ac60d214 /CHANGELOG.md | |
| parent | 1df1fc664c4a4b12807a49ef2f1a0effda6ce064 (diff) | |
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
Diffstat (limited to 'CHANGELOG.md')
| -rw-r--r-- | CHANGELOG.md | 13 |
1 files changed, 11 insertions, 2 deletions
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. |
