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
Use new_checked by default #195
Comments
Just a question/thought |
There is nothing inherently safer about constructing packets with Moreover, it's not even that one should be preferred over the other. In a typical network stack that both sends and receives packets there would be approximately as many calls to I'm open to other suggestions for these names, but I think that safety is the wrong angle here. |
Currently all
Packet
types have at least the two constructor methodsnew
andnew_checked
.new
does no length checks, whilenew_checked
obviously does. AFAIK instd
etc typically the "safe" version is the default and the "unsafe" version is explicitly called with<name>_unchecked
. Would it make sense to do something like the following?Packet::new_checked
Packet::new
functions do whatPacket::new_checked
doesPacket::new_unchecked
functions that do whatPacket::new
doesThe text was updated successfully, but these errors were encountered: