Skip to content

Fix #[cgp_getter] macro when the getter trait contains generic parameters#76

Merged
soareschen merged 5 commits intomainfrom
cgp-getter-generics
Feb 23, 2025
Merged

Fix #[cgp_getter] macro when the getter trait contains generic parameters#76
soareschen merged 5 commits intomainfrom
cgp-getter-generics

Conversation

@soareschen
Copy link
Collaborator

@soareschen soareschen commented Feb 23, 2025

Summary

This PR fixes the incorrect derivation of #[cgp_getter] when the getter trait contains generic parameters. Previously, the getter trait did not allow generic parameters to be specified, but this limitation was lifted in #[cgp_auto_getter]. So we also need to update #[cgp_getter] to better support generic parameters.

Example

With the new support, we can use #[cgp_getter] with traits such as follows:

#[cgp_getter {
    provider: NameGetter,
}]
pub trait HasName<App>
where
    App: HasNameType,
{
    fn name(&self) -> &App::Name;
}

@soareschen soareschen merged commit 1cae8d8 into main Feb 23, 2025
5 checks passed
@soareschen soareschen deleted the cgp-getter-generics branch February 23, 2025 19:55
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