Allow attributes in std::bitflags::bitflags!
The `std::bitflags::bitflags!` macro did not provide support for adding attributes to the generated structure or flags, due to limitations in the parser for macros. This patch works around the parser limitations by requiring a `flags` keyword in the overall `bitflags!` invocation, and a `static` keyword for each flag: bitflags!( #[deriving(Hash)] #[doc="Three flags"] flags Flags: u32 { #[doc="The first flag"] static FlagA = 0x00000001, static FlagB = 0x00000010, static FlagC = 0x00000100 } )
Showing
想要评论请 注册 或 登录