smessmer / binary-layout

The binary-layout library allows type-safe, inplace, zero-copy access to structured binary data. You define a custom data layout and give it a slice of binary data, and it will allow you to read and write the fields defined in the layout from the binary data without having to copy any of the data. It's similar to transmuting to/from a #[repr(packed)] struct, but much safer.
Apache License 2.0
66 stars 9 forks source link

Added NativeEndian support #22

Closed carlsverre closed 1 year ago

carlsverre commented 1 year ago

I built this feature in order to use this library to model in-memory data structures which nest fixed endianness within larger native endian encoded data.

Closes #21

carlsverre commented 1 year ago

@smessmer - looking forward to your thoughts. I tried to keep this as simple as possible. I don't think there should be any overhead or API change for folks who aren't using the NativeEndian marker. Test wise, I tried to add a test variant for every test that touched more than one Endianess. I also didn't touch the docs too much since I would like your thoughts on how to present this feature to users.

Thank you!

carlsverre commented 1 year ago

From a quick scan it appears the failing builds are also failing in master? Something about not building the cross dependency?

carlsverre commented 1 year ago

Also the gen_readme script doesn't run on my mac. Waiting for a docker image to download so I can run it in there instead.

edit - the issue is that osx sed has a slightly different expectation on how args are specified, I was able to run the script by installing gnu-sed using brew

smessmer commented 1 year ago

Hi, sorry for dropping the ball, this somehow fell off my task list. Thanks for implementing this and for adding comprehensive test coverage.

carlsverre commented 1 year ago

No worries! Appreciate your time and work maintaining this library. Cheers!