Releases: jam1garner/binrw
Version 0.10.0
Breaking changes
-
The
read_byteshelper, deprecated since 0.2.0, has been removed. UseVec<u8>directly. -
The
NullStringandNullWideStringAPIs have been rewritten to use only standard Rust traits:before 0.10 as of 0.10 T::from_string(s)From<String>orFrom<&str>s.into_string()s.to_string()orDisplaytraits.into_string_lossless()TryFrom<T> for Stringtrait -
Two
BinWriteAPI functions have been renamed for consistency with theBinReadAPI:before 0.10 as of 0.10 BinWrite::write_to(...)BinWrite::write(...)BinWrite::write_with_args(...)BinWrite::write_args(...) -
The
HasMagictrait has been renamed tometa::ReadMagic. -
The
Endian::Nativevariant has been removed and replaced by an equivalent constant,Endian::NATIVE. -
The
Defaultimplementation forEndianhas been removed. Use an explicit value where needed instead. -
Convenience functions that do not accept a byte order (e.g.
BinRead::read(...),BinWrite::write(...)) are now only callable if the underlying type also implementsmeta::ReadEndian(for reads) andmeta::WriteEndian(for writes). This prevents unintentional architecture-specific byte ordering. These new traits are automatically derived for types that specify a byte order and for built-in types that do not have any endianness (e.g.Vec<u8>).
New features
- The
BufReaderwrapper significantly improves performance when reading from non-memory streams (#141) - The
NoSeekwrapper enables reading and writing non-seekable streams (#6, #78) - Non-zero integer types are now supported by
BinRead,BinWrite, andFilePtr(#134) - Added performance tips to the documentation (#130)
Enhancements
binread,binrw, andbinwriteattributes are now also part of the binrw prelude- Improved performance reading integer primitives into collections (e.g.
Vec<u32>) (#129) - The
ifdirective is now also supported in#[bw]attributes (#113, #146) - Tuples can now use any args type that implements
Clone - Error messages are now clearer when
countandargsare incorrectly combined, or when passing the wrong type toargs(#112) - More impls have been added to the
no_stdimplementations of theReadandWritetraits to improve feature parity with thestdimplementations - The
Debugimplementations ofNullStringandNullWideStringno longer allocate memory - Documentation has been generally improved (#75, #76, #103, #142)
- Write support is now fully documented
- Enum error handling modes are now documented
- Explicit endian helper functions are now also available on
BinReadandBinWrite
Bug fixes
- Using
try_map = {closure}on a struct now generates valid code - Errors in
argsdirectives now point to the correct location of the problem - The optimised
impl BinWrite for Box<[u8]>is now actually selected by the compiler - Using named arguments no longer triggers clippy warnings about missing docs (#124)
- Trailing commas no longer cause parsing errors in
binrw::args! NullStringandWideNullStringtypes are now correctly marked withEq- Enum variants no longer sometimes unintentionally inherit directives from the parent enum
- Deriving
BinWriteon unit structs no longer causes a panic pre_assertdirectives now correctly apply to unit enum values- Line numbers in verbose backtraces are now correctly padded when the number of digits in the line number increases