Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support derive macro for types with non-static lifetimes #53

Open
coderedart opened this issue Jun 27, 2022 · 3 comments
Open

support derive macro for types with non-static lifetimes #53

coderedart opened this issue Jun 27, 2022 · 3 comments

Comments

@coderedart
Copy link

I have a bunch of types like Window<'open> or Ui(&mut egui::Ui) etc.. and i would like to use MluTealrDerive on them.

but i keep getting lifetime errors. i can manually write the impls ofcourse, was just wondering if it would be possible to just make the macro support for types with lifetimes.

@coderedart
Copy link
Author

for some reason, i cannot implement the TypeBody for types with lifetimes. rust complains that it needs a 'static lifetime.

@lenscas
Copy link
Owner

lenscas commented Jun 27, 2022

If i remember correctly, the macro quickly gets complex once generics of any kind get involved, which is why I haven't done it myself. I'll gladly accept pr's that make it work though.

I'll see what I can do about the typebody needing a static lifetime. Probably just wrote a weird lifetime myself.

However, are you sure you actually need a non static in this case? Type body is only used to generate the .d.tl file and documentation and doesn't even require an instance of the type

@coderedart
Copy link
Author

However, are you sure you actually need a non static in this case? Type body is only used to generate the .d.tl file and documentation and doesn't even require an instance of the type

you are right! i was able to implement TypeBody for a 'static lifetimed struct.

I will just implement the Traits manually for now.

lenscas added a commit that referenced this issue Jul 3, 2022
lenscas added a commit that referenced this issue Jul 3, 2022
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

No branches or pull requests

2 participants