-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add consistent way of initializing custom event kinds #52
Comments
Maybe the best way is to impl |
Something like: impl PartialEq<Kind> for Kind {
fn eq(&self, other: &Kind) -> bool {
self.as_u64() == other.as_u64()
}
} |
Sounds promising. |
Now I have the doubt to have misunderstood what you mean. I don't think that can be enforced the use of Using the solution that I applied, if someone used Kind::Custom instead Kind::Ephemeral everything works (I added ephemeral kind not long ago). In this way it's backwards compatible. |
Tested the new version, works! Thanks. You're right, your idea with |
Describe the enhancement
It's possible to construct event kinds that make them incompatible with (i.e. not
==
to) the json deserialized version of themselves.The enhancement would be to only expose valid ways of constructing event kinds, such that this is not an issue anymore.
Use case
For example, for a custom kind 20100, which is in the ephemeral range:
Additional context
The only way I can think of is to enforce kinds to only be constructed via
Kind::from(u64)
, although not sure how to do that.The text was updated successfully, but these errors were encountered: