bytes
bytes copied to clipboard
Provide try_get_* methods for `Buf`
Add try_get_* methods on Buf which return error values rather than panicking when there are not enough remaining bytes. This allows for cleaner networking code when dealing with variable-length packets.
Resolves #254.
I think I'm fine with this. In the next breaking release, all of these fns will be moved to an ext trait anyway.
I wonder what others think.
cc @seanmonstar
This would be great to have IMO
Can we get this PR updated?
Working on the h3 we have workaround traits for not panicking in the webserver if the incoming frame was not long enough or malformed. It would be great to have this kind of thing in Bytes directly