Skip to content

Commit 4fb346e

Browse files
committed
Clean up "README.md" file of enumcapsulate-macros crate
1 parent 45db8c3 commit 4fb346e

File tree

1 file changed

+15
-57
lines changed

1 file changed

+15
-57
lines changed

macros/README.md

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -105,37 +105,37 @@ then you can do so by use of an `#[enumcapsulate(exclude(…))]` attribute:
105105
enum Enum { /* ... */ }
106106
```
107107
108-
##### `#[enumcapsulate(discriminant(repr = …))]`
108+
##### `#[enumcapsulate(discriminant(name = …))]`
109109
110-
Specify a memory representation for the generated discriminant type.
110+
Specify a custom name for the generated discriminant type.
111111
112112
> [!IMPORTANT]
113113
> This attribute is only recognized by the `VariantDiscriminant` derive macro.
114114
115-
If you wish to specify a custom memory representation for the discriminant
116-
type generated by the `VariantDiscriminant` derive macro, then you can
117-
do so by use of an `#[enumcapsulate(discriminant(repr = <typename>))]` attribute:
115+
If you wish to specify a custom name for the discriminant type
116+
generated by the `VariantDiscriminant` derive macro, then you can do
117+
so by use of an `#[enumcapsulate(discriminant(name = <typename>))]` attribute:
118118
119119
```rust
120120
#[derive(VariantDiscriminant)]
121-
#[enumcapsulate(discriminant(repr = u8))]
121+
#[enumcapsulate(discriminant(name = MyDiscriminant))]
122122
enum MyEnum { /* ... */ }
123123
```
124124
125-
##### `#[enumcapsulate(discriminant(name = …))]`
125+
##### `#[enumcapsulate(discriminant(repr = …))]`
126126
127-
Specify a custom name for the generated discriminant type.
127+
Specify a memory representation for the generated discriminant type.
128128
129129
> [!IMPORTANT]
130130
> This attribute is only recognized by the `VariantDiscriminant` derive macro.
131131
132-
If you wish to specify a custom name for the discriminant type
133-
generated by the `VariantDiscriminant` derive macro, then you can do
134-
so by use of an `#[enumcapsulate(discriminant(name = <typename>))]` attribute:
132+
If you wish to specify a custom memory representation for the discriminant
133+
type generated by the `VariantDiscriminant` derive macro, then you can
134+
do so by use of an `#[enumcapsulate(discriminant(repr = <typename>))]` attribute:
135135
136136
```rust
137137
#[derive(VariantDiscriminant)]
138-
#[enumcapsulate(discriminant(name = MyDiscriminant))]
138+
#[enumcapsulate(discriminant(repr = u8))]
139139
enum MyEnum { /* ... */ }
140140
```
141141
@@ -195,11 +195,11 @@ enum Enum {
195195
196196
Select a specific variant field as target for trait derivation.
197197
198-
- `#[enumcapsulate(field(index = <index>))]`
198+
- `#[enumcapsulate(field = <index>)]`
199199
200200
Select field at index `<index>` to be used as target.
201201
202-
- `#[enumcapsulate(field(name = "<name>"))]`
202+
- `#[enumcapsulate(field = <name>)]`
203203
204204
Select field with name `<name>` to be used as target.
205205
@@ -226,7 +226,7 @@ enum Enum {
226226
VariantA(i32, VariantA),
227227
228228
// Select field `b`, i.e. `VariantB`:
229-
#[enumcapsulate(field(name = "b"))]
229+
#[enumcapsulate(field(name = b))]
230230
VariantB { b: VariantB, c: u32 },
231231
}
232232
```
@@ -237,27 +237,6 @@ enum Enum {
237237
>
238238
> Alternatively the variant can be excluded via `#[enumcapsulate(exclude)]`.
239239
240-
##### `#[enumcapsulate(discriminant(value = …))]`
241-
242-
Specify a memory representation for the generated discriminant type.
243-
244-
> [!IMPORTANT]
245-
> This attribute is only recognized by the `VariantDiscriminant` derive macro.
246-
247-
If you wish to specify a custom memory representation for the discriminant
248-
type generated by the `VariantDiscriminant` derive macro, then you can
249-
do so by use of an `#[enumcapsulate(discriminant(value = <expr>))]` attribute:
250-
251-
```rust
252-
#[derive(VariantDiscriminant)]
253-
enum Enum {
254-
#[enumcapsulate(discriminant(value = 42))]
255-
VariantA(i32),
256-
257-
VariantB { b: u32 },
258-
}
259-
```
260-
261240
##### `#[enumcapsulate(discriminant(name = …))]`
262241
263242
Specify a custom name for the generated discriminant type.
@@ -300,27 +279,6 @@ enum Enum {
300279
}
301280
```
302281
303-
##### `#[enumcapsulate(discriminant(name = …))]`
304-
305-
Specify a custom name for the generated discriminant type.
306-
307-
> [!IMPORTANT]
308-
> This attribute is only recognized by the `VariantDiscriminant` derive macro.
309-
310-
If you wish to specify a custom name for the discriminant type
311-
generated by the `VariantDiscriminant` derive macro, then you can do
312-
so by use of an `#[enumcapsulate(discriminant(name = …))]` attribute:
313-
314-
```rust
315-
#[derive(VariantDiscriminant)]
316-
enum Enum {
317-
#[enumcapsulate(discriminant(name = CustomDiscriminant))]
318-
VariantA(i32),
319-
320-
VariantB { b: u32 },
321-
}
322-
```
323-
324282
## Generics
325283
326284
There is limited support for generic enums:

0 commit comments

Comments
 (0)