File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,33 @@ enum Enum {
279
279
}
280
280
```
281
281
282
+ ##### `#[enumcapsulate(discriminant(nested = …))]`
283
+
284
+ Specify a nested sub- discriminant type for the generated discriminant variant.
285
+
286
+ > [! IMPORTANT ]
287
+ > This attribute is only recognized by the `VariantDiscriminant ` derive macro .
288
+
289
+ If you wish a discriminant variant generated by the `VariantDiscriminant `
290
+ derive macro to be nested, then you can do so by use
291
+ of an `#[enumcapsulate(discriminant(nested = …))]` attribute:
292
+
293
+ ```rust
294
+ #[derive(VariantDiscriminant )]
295
+ enum VariantA {
296
+ VariantA1 ,
297
+ VariantA2 ,
298
+ }
299
+
300
+ #[derive(VariantDiscriminant )]
301
+ enum Enum {
302
+ #[enumcapsulate(discriminant(nested = VariantADiscriminant ))]
303
+ VariantA (i32 ),
304
+
305
+ VariantB { b: u32 },
306
+ }
307
+ ```
308
+
282
309
## Generics
283
310
284
311
There is limited support for generic enums:
You can’t perform that action at this time.
0 commit comments