1#[macro_export]
3macro_rules! Const
4{
5 (
6 $( #[ $Config:meta ] )*
7 $Visibility:vis $Struct:ident: $Type:ty
8 {
9 $(
10 $( #[ $Variant:meta ] )*
11 $Const:ident = $Value:expr$(,)*
12 )*
13 }
14 )
15 => {
16 $( #[ $Config ] )*
17 #[derive(Copy,Clone,Debug,Eq,Hash,Ord,PartialEq,PartialOrd)]
18 $Visibility struct $Struct ( $Type );
19 impl $Struct
20 {
21 $(
22 $( #[ $Variant ] )*
23 pub const $Const: $Struct = $Struct ( $Value );
24 )*
25 }
26 };
27 (
28 $( #[ $Config:meta ] )*
29 $Visibility:vis $Struct:ident
30 {
31 $(
32 $( #[ $Variant:meta ] )*
33 $Const:ident = $Value:expr$(,)*
34 )*
35 }
36 )
37 => {
38 $( #[ $Config ] )*
39 #[derive(Copy,Clone,Debug,Eq,Hash,Ord,PartialEq,PartialOrd)]
40 $Visibility struct $Struct ( usize );
41 impl $Struct
42 {
43 $(
44 $( #[ $Variant ] )*
45 pub const $Const: $Struct = $Struct ( $Value );
46 )*
47 }
48 };
49}