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

Fix no_std compatibility #25

Closed cpaplham closed 3 months ago

cpaplham commented 4 months ago

Under certain build configurations, Rust will build all libraries listed under [dependencies] and not just those which are actually used. This change makes thiserror a dependency of the std feature so that doesn't happen.

smessmer commented 3 months ago

Interesting. There is a test in the CI that runs with --no-default-features. That should disable the std feature, and then this line should enable no-std mode. The CI test passes. Can you give more info under which circumstances nostd would fail so I can amend the CI job to test for that?

smessmer commented 3 months ago

Thanks, merging https://github.com/smessmer/binary-layout/pull/28 which includes these changes and adds a test on top. This will be in version 4.0.2.