Attribute Macro flatty_macros::flat

source ·
#[flat]
Expand description

Attribute macro that creates a flat type from struct or enum declaration.

Usage examples

#[flatty::flat(sized = false)]
struct ... { ... }

or

#[flatty::flat(sized = false, tag_type = "u32")]
enum ... { ... }

Arguments

  • sized: bool, optional, true by default. Whether structure is sized or not.
  • tag_type: str, for enum declaration only, optional, "u8" by default. The type used for enum variant index. Possible values: "u8", "u16", "u32".
  • portable: bool, optional, false by default. Whether structure should implement Portable.
  • default: bool, optional, false by default. Whether to create default constructors (see FlatDefault).