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

parse protocol bytes via num-traits #95

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

hdhoang
Copy link
Collaborator

@hdhoang hdhoang commented Mar 19, 2019

Also express the message-ACK relationship better.

todo: propagate further up the stack with better error handling.

implement #92, and may help with #20, #63.

@Pzixel
Copy link

Pzixel commented Mar 19, 2019

Self::from_u8(b).expect("unhandled MsgType")

From the docs:

Simple and safe type conversions in to Self. It is the reciprocal of Into.

Note: this trait must not fail. If the conversion can fail, use TryFrom or a dedicated method which returns an Option or a Result<T, E>.

So From shouldn't fail, and by fail they mean any failure, including panic, I consulted the devs some time ago, so you break the core assumptions by that.

@hdhoang
Copy link
Collaborator Author

hdhoang commented Mar 19, 2019

great, thanks for the pointer! I will move the error-handling somewhere more appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants