Skip to content

Releases: smessmer/binary-layout

4.0.2

14 Apr 00:28
Compare
Choose a tag to compare
  • Fix no-std support and add a CI job testing for it (#25 and #28 )
  • Add CI jobs checking this crate for SemVer-breaking API changes
  • Fix codecov CI job

4.0.1

10 Feb 07:01
Compare
Choose a tag to compare

Fix broken links in README

4.0.0

08 Feb 09:52
Compare
Choose a tag to compare

This release adds supports for types that can throw errors when reading or writing.

New primitive types supported:

  • std::num::NonZeroXXX types
  • bool as u8 (only 0 and 1 are valid representations, others will throw errors when read)
  • char as u32 (invalid unicode will throw errors when read)

When reading any of those types, the read() function will not be available and instead there will be a try_read() function.

The LayoutAs trait changed and if you're using that to define custom data types, then you now need to implement try_read / try_write
instead of read / write.
If reading and/or writing your type cannot fail, you can set the corresponding error type to std::convert::Infallible.
That will ensure that your type will have the read() / write() functions available on your layout fields.
For any other error types, you will have to access the fields using calls to try_read() / try_write().

Backwards compatibility:
Most code should remain backwards compatible, but there are a few scenarios that require you to change your code:

  • Updated MSRV to 1.59
  • If you did not use use binary_layout::prelude::* but instead imported the binary_layout traits manually, then you may have to add an import to
    FieldReadExt and FieldWriteExt because that is where the read() and write() methods that were previously on FieldCopyAccess moved to.
  • Types implementing LayoutAs now need to be Sized.
  • The LayoutAs trait changed. You now need to implement try_read and try_write instead of read and write and define the corresponding error types.
  • Renamed define_layout! macro to binary_layout!. For now, define_layout! still works but will show a deprecation warning and it will be removed in a future version.

3.3.0

06 Feb 02:37
Compare
Choose a tag to compare

Changelog

  • Reduce minimal dependency version requirements to what's actually needed and add a CI task ensuring that those versions are sufficient

3.2.0

05 Aug 21:41
Compare
Choose a tag to compare
  • Add NativeEndian as an option

3.1.4

05 Aug 21:40
Compare
Choose a tag to compare
  • Fix compiler warnings issued by newer version of rust

3.1.3

23 Nov 20:33
Compare
Choose a tag to compare
  • Specify MSRV in Cargo.toml
  • Improve CI setup

3.1.2

07 Nov 23:31
Compare
Choose a tag to compare
  • Fixed clippy warnings
  • Fixed broken doc links and documentation typos
  • Use caret in dependency versions (i.e. depend on ^0.8 instead of 0.8)

3.1.1

25 Jul 05:50
Compare
Choose a tag to compare
  • Fix clippy warnings

3.1.0

25 Jul 05:50
Compare
Choose a tag to compare
  • Fixed-size array fields (i.e. [u8; N]) now return &[u8; N] instead of &[u8] when accessed
  • Fix no_std compatibility
  • Add Data::into_slice()