Skip to content

v0.19.0

Choose a tag to compare

@sharksforarms sharksforarms released this 25 Apr 18:55
· 37 commits to master since this release

Features

Added bit_order (#483)

After much development, bit_order is now a supported attribute! Msb is still the default bit-order for all operations,
but if you need Lsb ordering, deku now has you covered.

For example, the following is now possible:

# #[derive(Debug, DekuRead, DekuWrite, PartialEq)]
#[deku(bit_order = "lsb")] // <--
pub struct SquashfsV3 {
    #[deku(bits = "4")]
    inode_type: u8,
    #[deku(bits = "12")]
    mode: u16,
    uid: u8,
    guid: u8,
    mtime: u32,
    inode_number: u32,
}
let data: &[u8] = &[
//       inode_type
//     ╭-----------
//     |
//     |    mode
//    ╭+--------   ...and so on
//    ||    ||
//    vv    vv
    0x31, 0x12, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
];

If you were using our internal reader the following changed. As well as the leftover field now containing ordering.

- reader.read_bytes(exact.0, &mut bytes)?;
+ reader.read_bytes(exact.0, &mut bytes, Order::Lsb0)?;

Added bytes ctx for CString (#497)

#[derive(PartialEq, Debug, DekuRead, DekuWrite)]
pub struct Data {
    len: u8,
    #[deku(bytes = "*len as usize")]
    s: CString,
}

Changed id_pat (#540)

The id_pat attribute has been restored to the behavior of 0.16.0, removing the seek and re-read.

Allow token streams for bytes attribute (#489)

# #[derive(Debug, PartialEq, DekuRead, DekuWrite)]
struct DekuTest {
    field_a_size: u8,
    #[deku(bytes = "*field_a_size as usize")]
    field_a: u32,
}

Updates

  • Arc support by @vhdirk (#522)
  • Update no-std-io2 to 0.9.0 and Updated MSRV to 1.81 (#529)
  • Add field support for magic attribute (#503)
  • Add NoSeek type for unseekable Read + Write impls (#487)
  • Add performance specializations for count attribute + Vec<u8>(#481)
  • Reader may now take ownership of Read + Seek type. Thanks @wgreenburg (#521).

Fixes

  • Fix pad_* attributes in no_std (#478)
  • Fix bug with id_pat and read_bytes_const (#479)
  • Several fixes for scope and imports in proc-macros, thanks @Serial-ATA (#541, #538, #539)