Skip to content

v0.10.0

Compare
Choose a tag to compare
@Robbepop Robbepop released this 29 Oct 19:29
· 42 commits to master since this release
v0.10.0
6f579bf

0.10.0 (2020-10-29)

  • (Thanks @jam1garner): The #[bitfield] macro now looks for #[derive(Debug)] annotations and if found will implement
    one that formats the struct with its fields as a user would expect them. Previously having a #[derive(Debug)]
    annotation on a #[bitfield] struct would simply print the contents of the generated internal byte array.
  • Implement #[bitfield(bytes = N)] parameter to ensure at compile time that the bitfield struct
    requires N bytes of memory.
  • Implement #[bitfield(filled: bool)] parameter to control whether the bitfield struct ensures that either
    all bits are well defined (filled = true) or if there are going to be some bits intentionally undefined (filled = false).
    The default is filled = true.
  • Implement #[repr(uN)] for #[bitfield] structs where uN is one of u8, u16, u32, u64 or u128 with which it is
    possible to control whether a bitfield allow conversions between uN and the bitfield. Also it ensures at compile time that
    the bitfield requires the exact same amount of bits. This is in conflict with filled = false.
  • Bitfield structs are no longer implicitly #[repr(transparent)]. If a user wants their bitfield struct to remain transparent
    they have to add #[repr(transparent)] manually to their struct definition.
  • The default behaviour for #[bitfield(specifier = bool)] got changed so that it no longer by default allows for
    unfilled (filled = false) or undefined bits. Instead users now have to additionally add filled = false if they
    explicitly want this behaviour.
  • Renamed the generated as_bytes method for #[bitfield] structs to into_bytes. It now takes self instead of &self
    and returns the byte array by value instead of reference. This change was necessary for working properly with the new
    #[repr(uN)] feature.
  • Fixed a bug with #[bitfield(specifier = true)] bitfields that were not aligned to have a power-of-two bytes.