-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make cqrs::TypedEvent static #21
Conversation
@50U10FCA7 please, remind me, why we don't use arrays and slices and |
@tyranron Most traits implemented on Also checked the variant with constant slices and it doesn't work with generics too. At now it's impossible to pass generic to constant. Compiler throws these errors on attempt to pass generic/associated item to constant:
Here's a MRE: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d206aef139f79bfc27c94e18c4bd0274 |
@ilslv ping |
@50U10FCA7 I believe you can hack around it by generating separate non-generic struct and implement In |
@ilslv There still problem with const evaluation: playground. Const block is required because of nested event types concatenation. Concatenation uses this solution. |
@50U10FCA7 please provide more exact MRE, because I don't understand why are you using inline const in |
Full MRE looks like this. I tried to avoid the problem with: |
@50U10FCA7 I've got pretty close to make it work, but compiler warned about this issue
So I think we can simply replace every generic parameter with |
FCM
|
For optimization purposes result of cqrs::TypedEvent::event_types() should be generates once.
There's two ways to do implement this:
Add additional trait cqrs::TypedEventStatic which provides static version of event_types;
Replace implementation of cqrs::TypedEvent to make it static.