1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use c_enum::c_enum;

c_enum! {
    #[derive(Clone, Copy, PartialEq, Eq, Hash)]
    pub enum Enum : u64 {
        DefaultVariant,

        /// We can also put doc comments and other attributes on a variant.
        DocumentedVariant,

        /// Or, we can assign values to a variant.
        VariantWithValue = 0x777,

        /// We can also refer to the values of other variants.
        VariantWithComputedValue = Self::DefaultVariant.0 + 7,
    }
}