@@ -9,7 +9,7 @@ use std::path::PathBuf;
99use serde:: { Deserialize , Serialize } ;
1010
1111/// rustdoc format-version.
12- pub const FORMAT_VERSION : u32 = 18 ;
12+ pub const FORMAT_VERSION : u32 = 19 ;
1313
1414/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
1515/// about the language items in the local crate, as well as info about external items to allow
@@ -308,11 +308,28 @@ pub struct Enum {
308308#[ serde( rename_all = "snake_case" ) ]
309309#[ serde( tag = "variant_kind" , content = "variant_inner" ) ]
310310pub enum Variant {
311- Plain ,
311+ Plain ( Option < Discriminant > ) ,
312312 Tuple ( Vec < Type > ) ,
313313 Struct ( Vec < Id > ) ,
314314}
315315
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+
316333#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
317334#[ serde( rename_all = "snake_case" ) ]
318335pub enum StructType {
0 commit comments