Crates.io | encap_enum |
lib.rs | encap_enum |
version | 0.3.1 |
source | src |
created_at | 2020-06-17 06:08:23.954504 |
updated_at | 2020-07-13 01:17:05.969704 |
description | A non-verbose way to define a group of constants and bit flags. |
homepage | https://github.com/Razordor/encap_enum |
repository | https://github.com/Razordor/encap_enum |
max_upload_size | |
id | 254835 |
size | 32,479 |
Encap_Enum provides the encap_enum!
macro for defining enumerations, bitflags and groups of constants.
Add this to your Cargo.toml
:
[dependencies]
encap_enum = "0.3.1"
and this to your crate root:
#[macro_use]
extern crate encap_enum;
enum
visibility for both internal values and the enum itself.#[repr(C)]
, #[derive]
, and many others.encap_enum!{
/// ClassStyle is a structure used in the Window class.
#[repr(C)]
pub enum ClassStyle: pub u32 {
ByteAlignClient = 0x0000_1000,
ByteAlignWindow = 0x0000_2000, /// Aligns window on a byte boundary.
DoubleClicks = 0x0000_0008,
DropShadow = 0x0002_0000,
GlobalClass = 0x0000_4000,
// ...
}
}
fn main() {
println!("ByteAlignClient integer representation: {}", ClassStyle::ByteAlignClient.raw);
println!("ByteAlignClient debug representation: {:?}", ClassStyle::ByteAlignClient);
}
encap_enum
is licenced under the MIT Licence.