Version 0.12.0
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 thefile_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 manualBinRead
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 toread_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
, andpostprocess_now
have been removed as they were designed to control theafter_parse
API which no longer exists. Any field with aderef_now
orpostprocess_now
directive can simply remove the directive to achieve equivalent functionality. Any struct that usedoffset_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 anassert
directive is no longer supported. Replacethis
with the supportedself
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 theseek_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 theself
keyword. (Thanks, @octylFractal!) (#219)
Enhancements
Clone
is no longer a required trait for arguments passed toparse_with
functions. (Thanks, @octylFractal!)Clone
is no longer a required trait for arguments passed toBinReaderExt
methods.BinRead
is no longer a required trait for dereferencing a value fromFilePtr
. (#218)map
andtry_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 usingpad_before
oralign_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.