Skip to content

Version 0.12.0

Compare
Choose a tag to compare
@csnover csnover released this 21 Sep 21:31
· 38 commits to master since this release
v0.12.0
d4efd00

Breaking changes

  • The default behaviour of FilePtr has been changed to always immediately seek to and read the pointed-to value. Helper functions have been added to the file_ptr module to support the common case of reading from an offset table. Additional helper functions and types will be added in future releases to improve support for file indirection.
  • The BinRead::after_parse API has been removed since it was rarely used, usually broken by manual BinRead implementations, and made it impossible to use borrowed values in arguments in some cases. For custom two-pass parsing, one alternative is to create an object that will store data that need to be used during the second pass, pass a mutable reference to that object as an argument to read_options, add data to that object during the first pass, then use the recorded data from the object to perform the required action for the second pass.
  • deref_now, offset_after, and postprocess_now have been removed as they were designed to control the after_parse API which no longer exists. Any field with a deref_now or postprocess_now directive can simply remove the directive to achieve equivalent functionality. Any struct that used offset_after should reorder the fields so the dependent field is after the offset location.

For more detail on these changes, see #210.

  • Selected helper functions are no longer re-exported to the root of the crate. Access these helper functions, plus all the other helper functions that were never re-exported to the root, from the helpers module.
  • Using the undocumented internal variable this from an assert directive is no longer supported. Replace this with the supported self keyword instead.

New features

  • Helper functions for more efficient reading of offset tables have been added to the file_ptr module. These helpers can be combined with the seek_before directive to support both relative and absolute positioning of the pointed-to data. See the documentation for usage information and examples.
  • assert directives on structs, non-unit enums, and data variants can now access the constructed object using the self keyword. (Thanks, @octylFractal!) (#219)

Enhancements

  • Clone is no longer a required trait for arguments passed to parse_with functions. (Thanks, @octylFractal!)
  • Clone is no longer a required trait for arguments passed to BinReaderExt methods.
  • BinRead is no longer a required trait for dereferencing a value from FilePtr. (#218)
  • map and try_map functions can now mutably borrow values.
  • dbg now also prints information about any padding and alignment directives on a field.
  • Various documentation improvements.

Bug fixes

  • The count directive no longer attempts useless conversions. (Thanks, @poliorcetics!) (#206)
  • dbg now returns the correct position of a field when using pad_before or align_before. (#188)
  • Parser errors are no longer discarded if a stream rewind fails. (#215)
  • Implementation details of binrw will no longer cause borrow checker failures when passing borrowed arguments to child objects.