Skip to content

Move function attributes in #[cgp_fn] to trait and impl#220

Merged
soareschen merged 2 commits intomainfrom
move-cgp-fn-attributes
Mar 26, 2026
Merged

Move function attributes in #[cgp_fn] to trait and impl#220
soareschen merged 2 commits intomainfrom
move-cgp-fn-attributes

Conversation

@soareschen
Copy link
Copy Markdown
Collaborator

@soareschen soareschen commented Mar 26, 2026

This PR improves #[cgp_fn] to move the attributes on fn to the derived trait and impl.

This is to allow attributes like #[async_trait] to be applied to the generated trait, and transform the async methods in the trait.

When the user want to apply attributes on the function itself, they can do so by placing the attribute before #[cgp_fn]. That way, the proc macro will see the original fn before the transformation happens.

@soareschen soareschen merged commit 3665962 into main Mar 26, 2026
5 checks passed
@soareschen soareschen deleted the move-cgp-fn-attributes branch March 26, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant