@@ -9,7 +9,7 @@ use std::path::PathBuf;
9
9
use serde:: { Deserialize , Serialize } ;
10
10
11
11
/// rustdoc format-version.
12
- pub const FORMAT_VERSION : u32 = 18 ;
12
+ pub const FORMAT_VERSION : u32 = 19 ;
13
13
14
14
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
15
15
/// about the language items in the local crate, as well as info about external items to allow
@@ -308,11 +308,28 @@ pub struct Enum {
308
308
#[ serde( rename_all = "snake_case" ) ]
309
309
#[ serde( tag = "variant_kind" , content = "variant_inner" ) ]
310
310
pub enum Variant {
311
- Plain ,
311
+ Plain ( Option < Discriminant > ) ,
312
312
Tuple ( Vec < Type > ) ,
313
313
Struct ( Vec < Id > ) ,
314
314
}
315
315
316
+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
317
+ pub struct Discriminant {
318
+ /// The expression that produced the discriminant.
319
+ ///
320
+ /// Unlike `value`, this preserves the original formatting (eg suffixes,
321
+ /// hexadecimal, and underscores), making it unsuitable to be machine
322
+ /// interpreted.
323
+ ///
324
+ /// In some cases, when the value is to complex, this may be `"{ _ }"`.
325
+ /// When this occurs is unstable, and may change without notice.
326
+ pub expr : String ,
327
+ /// The numerical value of the discriminant. Stored as a string due to
328
+ /// JSON's poor support for large integers, and the fact that it would need
329
+ /// to store from [`i128::MIN`] to [`u128::MAX`].
330
+ pub value : String ,
331
+ }
332
+
316
333
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
317
334
#[ serde( rename_all = "snake_case" ) ]
318
335
pub enum StructType {
0 commit comments