We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
VARIANTS
1 parent 1707a3c commit bd8223cCopy full SHA for bd8223c
enum-collections-macros/src/lib.rs
@@ -29,17 +29,30 @@ pub fn derive_enum_collections(input: TokenStream) -> TokenStream {
29
variants.extend(quote! { Self::#variant_name, });
30
}
31
32
- quote! {
+ #[cfg(feature = "variants")]
33
+ return quote! {
34
impl #generics Enumerated for #name #generics {
35
36
fn position(self) -> usize {
37
self as usize
38
39
40
const SIZE: usize = #enum_len;
- #[cfg(feature = "variants")]
41
const VARIANTS: &'static [Self] = &[#variants];
42
43
44
- .into()
+ .into();
45
+
46
+ #[cfg(not(feature = "variants"))]
47
48
+ impl #generics Enumerated for #name #generics {
49
50
+ fn position(self) -> usize {
51
+ self as usize
52
+ }
53
54
+ const SIZE: usize = #enum_len;
55
56
57
58
0 commit comments