@@ -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 = 19 ;
12
+ pub const FORMAT_VERSION : u32 = 20 ;
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,9 +308,36 @@ 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
+ /// A variant with no parentheses, and possible discriminant.
312
+ ///
313
+ /// ```rust
314
+ /// enum Demo {
315
+ /// PlainVariant,
316
+ /// PlainWithDiscriminant = 1,
317
+ /// }
318
+ /// ```
311
319
Plain ( Option < Discriminant > ) ,
312
- Tuple ( Vec < Type > ) ,
313
- Struct ( Vec < Id > ) ,
320
+ /// A variant with unnamed fields.
321
+ ///
322
+ /// Unlike most of json, `#[doc(hidden)]` fields will be given as `None`
323
+ /// instead of being ommited, because order matters.
324
+ ///
325
+ /// ```rust
326
+ /// enum Demo {
327
+ /// TupleVariant(i32),
328
+ /// EmptyTupleVariant(),
329
+ /// }
330
+ /// ```
331
+ Tuple ( Vec < Option < Id > > ) ,
332
+ /// A variant with named fields.
333
+ ///
334
+ /// ```rust
335
+ /// enum Demo {
336
+ /// StructVariant { x: i32 },
337
+ /// EmptyStructVariant {},
338
+ /// }
339
+ /// ```
340
+ Struct { fields : Vec < Id > , fields_stripped : bool } ,
314
341
}
315
342
316
343
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
0 commit comments