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

Derive for impl WebSocketEvent for ... {} #486

Closed
bitfl0wer opened this issue Apr 16, 2024 · 0 comments · Fixed by #491
Closed

Derive for impl WebSocketEvent for ... {} #486

bitfl0wer opened this issue Apr 16, 2024 · 0 comments · Fixed by #491

Comments

@bitfl0wer
Copy link
Member

In chorus, every event which is also a WebSocketEvent needs to implement the WebSocketEvent trait.
The WebSocketEvent trait is a marker trait, which means it has no methods or associated types. It is used to group all events that can be sent over a WebSocket connection.

Currently, the WebSocketEvent marker trait gets implemented as such

impl WebSocketEvent for Event1 {}

This is a bit cumbersome, as it requires us to manually implement the trait for every event. It would be nice if we could add a derive macro to automatically implement the trait for us.

#[derive(WebSocketEvent)]
struct Event1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants