Skip to content

Allow first argument in #[cgp_getter] methods to be non-self#169

Merged
soareschen merged 6 commits intomainfrom
getter-receiver
Oct 11, 2025
Merged

Allow first argument in #[cgp_getter] methods to be non-self#169
soareschen merged 6 commits intomainfrom
getter-receiver

Conversation

@soareschen
Copy link
Collaborator

@soareschen soareschen commented Oct 11, 2025

Summary

This PR improves the #[cgp_getter] macro to allow values other than self to be the receiver of the first argument in the getter method.

For example, the following is now allowed:

#[cgp_getter]
pub trait HasFooBar: HasFooType + HasBarType {
    fn foo_bar(foo: &Self::Foo) -> &Self::Bar;
}

@soareschen soareschen merged commit c51d377 into main Oct 11, 2025
5 checks passed
@soareschen soareschen deleted the getter-receiver branch October 11, 2025 10:54
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