Upgrade Message To An Enum#821
Open
danii wants to merge 4 commits intoseanmonstar:masterfrom
Open
Conversation
jxs
requested changes
Jun 29, 2021
Collaborator
jxs
left a comment
There was a problem hiding this comment.
Hi, and thanks for the PR! only a couple minor things left
| } | ||
|
|
||
| /// Construct the default Close `Message`. | ||
| pub fn close() -> Message { |
Collaborator
There was a problem hiding this comment.
I'd just maintain the old behavior wdyt? You can close the socket without it being abruptly
| } | ||
|
|
||
| /// Returns true if this message is a Text message. | ||
| pub fn is_text(&self) -> bool { |
Collaborator
There was a problem hiding this comment.
on one side I'd just deprecate this old methods as one can just do matches! now, what do you also think @seanmonstar ?
EDIT: ah but if we maintain then this PR doesn't introduce breaking changes..
Author
|
Hello, I apologize for my procrastination. I know it isn't professional. I see that the pull request #903 has been made which does the same, is it the plan to close mine and merge the new one? If so shall I close mine or continue work? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I saw the old documentation said something about upgrading this struct to a non exhaustive enum in the future, plus I prefer matching over something like this as an enum, so, I made it an enum.
This shouldn't cause any breaking changes as far as I'm aware. Someone could've wrote something like
let Message {..} = some_message;, but really that has no practical use in any context, as such I highly doubt anyone wrote that in any production code.This should IMO improve usability of
Messages by quite a lot.