c_enum/example.rs
1use c_enum::c_enum;
2
3c_enum! {
4 #[derive(Clone, Copy, PartialEq, Eq, Hash)]
5 pub enum Enum : u64 {
6 DefaultVariant,
7
8 /// We can also put doc comments and other attributes on a variant.
9 DocumentedVariant,
10
11 /// Or, we can assign values to a variant.
12 VariantWithValue = 0x777,
13
14 /// We can also refer to the values of other variants.
15 VariantWithComputedValue = Self::DefaultVariant.0 + 7,
16 }
17}