Add native-endian variants for all get_x
and put_y
functions in Buf
and BufMut
#576
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.
This PR introduces native-endian variants of all the
get_x
functions inBuf
andput_y
functions inBufMut
. It is pretty much a straightforward copy-paste-and-tweak for each method. There are a lot of methods though, so this PR ended up being rather big.My use case for these is that I am trying to use bytes to parse records as generated by
perf_event_open
. The fields in these use the native endianness of the host so using any of the existing methods onBuf
would be wrong.I've gone over this PR several times and I think that I have caught all the copy-paste errors but there may still be some that I missed.
Fixes #549.