diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-05-07 13:24:15 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-07 13:24:15 +0800 |
| commit | 13a1723050f1d92d33cfff1040be12f39f189c9e (patch) | |
| tree | 19de09b5f44be6bc990f0f8e1b5d7b077684ea84 /CHANGELOG.md | |
| parent | 11f32d55a79853ae764d2cf7c07e7174ccb0c239 (diff) | |
Add support for resource injection in `#[chain]` macro
Diffstat (limited to 'CHANGELOG.md')
| -rw-r--r-- | CHANGELOG.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 23ceef5..6a99966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,29 @@ None 1. **\[macros\]** The `gen_program!()` macro now generates `pub fn this() -> &'static Program<#name>` for the generated program type, providing convenient static accessors. +2. **\[macros\]** The `#[chain]` macro now supports resource injection parameters (2nd to Nth). When you write: + +```rust +#[chain] +fn process(prev: HelloEntry, age: &Age, name: &Name) -> NextProcess { + // age and name are automatically injected from global resources +} +``` + +Will expand: + +```rust +fn proc(prev: HelloEntry) -> ChainProcess<ThisProgram> { + let age: &Age = ::mingling::this::<ThisProgram>() + .res_or_default::<Age>() + .as_ref(); + let name: &Name = ::mingling::this::<ThisProgram>() + .res_or_default::<Name>() + .as_ref(); + // original function body inlined here +} +``` + #### **BREAKING CHANGES**: None |
