@@ -89,9 +89,9 @@ Under the [default representation], the discriminant is interpreted as
89
89
an ` isize ` value. However, the compiler is allowed to use a smaller type (or
90
90
another means of distinguishing variants) in its actual memory layout.
91
91
92
- ### Assigning Discriminant Values
92
+ ### Assigning discriminant values
93
93
94
- #### Explicit Discriminants
94
+ #### Explicit discriminants
95
95
96
96
In two circumstances, the discriminant of a variant may be explicitly set by
97
97
following the variant name with ` = ` and a [ constant expression] :
@@ -114,7 +114,7 @@ following the variant name with `=` and a [constant expression]:
114
114
}
115
115
```
116
116
117
- #### Implicit Discriminants
117
+ #### Implicit discriminants
118
118
119
119
If a discriminant for a variant is not specified, then it is set to one higher
120
120
than the discriminant of the previous variant in the declaration. If the
@@ -167,7 +167,7 @@ enum OverflowingDiscriminantError2 {
167
167
}
168
168
```
169
169
170
- ### Accessing Discriminant
170
+ ### Accessing discriminant
171
171
172
172
#### Via ` mem::discriminant `
173
173
@@ -221,7 +221,7 @@ assert_eq!(21, FieldlessWithDiscrimants::Struct{} as u8);
221
221
assert_eq! (22 , FieldlessWithDiscrimants :: Unit as u8 );
222
222
```
223
223
224
- #### Pointer Casting
224
+ #### Pointer casting
225
225
226
226
If the enumeration specifies a [ primitive representation] , then the
227
227
discriminant may be reliably accessed via unsafe pointer casting:
@@ -249,7 +249,7 @@ assert_eq!(1, tuple_like.discriminant());
249
249
assert_eq! (2 , struct_like . discriminant ());
250
250
```
251
251
252
- ## Zero-variant Enums
252
+ ## Zero-variant enums
253
253
254
254
Enums with zero variants are known as * zero-variant enums* . As they have
255
255
no valid values, they cannot be instantiated.
0 commit comments