You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Not really an issue, but it is a bit annoying to make a bunch of if statements rather than one nice match statement.
Describe the solution you'd like
In Actix, the message was an enum, making it easier to match the message itself and handle the content. That won't work here, since Message is just a wrapper, but you could add a field or method that gives an enum (it could be called MessageType or something) that can be Binary, Text, Ping, Pong, etc. Then you could just match message.value and then handle the message differently for each branch.
Describe alternatives you've considered
You could try doing what Actix did and turn it into an enum itself, but that likely would require too much work refactoring the internals.
Additional context
Rust has made me love match statements.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Not really an issue, but it is a bit annoying to make a bunch of if statements rather than one nice match statement.
Describe the solution you'd like
In Actix, the message was an enum, making it easier to match the message itself and handle the content. That won't work here, since Message is just a wrapper, but you could add a field or method that gives an enum (it could be called
MessageType
or something) that can be Binary, Text, Ping, Pong, etc. Then you could justmatch message.value
and then handle the message differently for each branch.Describe alternatives you've considered
You could try doing what Actix did and turn it into an enum itself, but that likely would require too much work refactoring the internals.
Additional context
Rust has made me love match statements.
The text was updated successfully, but these errors were encountered: