Skip to content

v0.11.0

Compare
Choose a tag to compare
@Robbepop Robbepop released this 06 Nov 16:48
· 17 commits to master since this release
v0.11.0
575084b

0.11.0 (2020-11-06)

  • Add bits: int parameter to the #[bitfield] macro which allows to precisely control the resulting bit width
    of the generated bitfield struct. Use it like: #[bitfield(bits = 5)].
  • Replace #[bitfield(specifier = true)] syntax with #[bitfield] #[derive(BitfieldSpecifier)].
    Semantics of the new syntax is the same as the old.
  • It is now possible to flag fields of #[bitfield] structs with #[skip(..)] in order to skip code generation for them.
    There are possibilities to skip code generation of only setters using #[skip(setters)], only getters #[skip(getters)]
    or both. Having no arguments (e.g. just #[skip]) defaults to skipping both setters and getters.
    A neat trick is to specify double wildcards as identifiers for skipped fields to avoid having the need to come up with
    an identifier for them: For example: #[skip]: __: B10
  • Attributes applied to #[bitfield] fields are now properly propagated to their generated getters and setters.
    Note thought that it might be confusing that an attribute applied to a struct field is actually applied to a function
    through macro expansion.
  • Fixed several bugs and significantly improved error reporting for #[bits = N] field attributes for #[bitfield] fields.
  • Minor fixes and improvements to code generation:
    • The automatically implemented #[derive(Debug)] now produces code that the Rust 2015 edition will accept.
    • Some minor macro hygiene improvements.