hobofan / ambassador

Delegation of trait implementations via procedural macros
Apache License 2.0
245 stars 13 forks source link

Add support for associated types #26

Closed dewert99 closed 2 years ago

dewert99 commented 2 years ago

CLOSES #21.

In order to add support for associated types I needed to change the declarative macro arguments, making this a breaking change for users using another crate which exports delegatable traits. I added a backwards compatibility feature which allows crates exporting delegatable traits to upgrade and forward calls from the old macros to the new ones. This also adds an automatic "where clause" that checks that the type of the target implements the trait being delegated, or in the case of enums that all the variant types implement the trait being delegated and share the same associated types. I'm also creating another pull that expands on this one but again changes the declarative macro arguments so it would be great if you could pull them both before upgrading to the next version.