@@ -9,7 +9,7 @@ use std::path::PathBuf;
99use serde:: { Deserialize , Serialize } ;
1010
1111/// rustdoc format-version.
12- pub const FORMAT_VERSION : u32 = 20 ;
12+ pub const FORMAT_VERSION : u32 = 21 ;
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
@@ -289,13 +289,39 @@ pub struct Union {
289289
290290#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
291291pub struct Struct {
292- pub struct_type : StructType ,
292+ pub kind : StructKind ,
293293 pub generics : Generics ,
294- pub fields_stripped : bool ,
295- pub fields : Vec < Id > ,
296294 pub impls : Vec < Id > ,
297295}
298296
297+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
298+ #[ serde( rename_all = "snake_case" ) ]
299+ pub enum StructKind {
300+ /// A struct with no fields and no parentheses.
301+ ///
302+ /// ```rust
303+ /// pub struct Unit;
304+ /// ```
305+ Unit ,
306+ /// A struct with unnamed fields.
307+ ///
308+ /// ```rust
309+ /// pub struct TupleStruct(i32);
310+ /// pub struct EmptyTupleStruct();
311+ /// ```
312+ ///
313+ /// All [`Id`]'s will point to [`ItemEnum::StructField`]. Private and
314+ /// `#[doc(hidden)]` fields will be given as `None`
315+ Tuple ( Vec < Option < Id > > ) ,
316+ /// A struct with nammed fields.
317+ ///
318+ /// ```rust
319+ /// pub struct PlainStruct { x: i32 }
320+ /// pub struct EmptyPlainStruct {}
321+ /// ```
322+ Plain { fields : Vec < Id > , fields_stripped : bool } ,
323+ }
324+
299325#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
300326pub struct Enum {
301327 pub generics : Generics ,
@@ -357,14 +383,6 @@ pub struct Discriminant {
357383 pub value : String ,
358384}
359385
360- #[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
361- #[ serde( rename_all = "snake_case" ) ]
362- pub enum StructType {
363- Plain ,
364- Tuple ,
365- Unit ,
366- }
367-
368386#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
369387pub struct Header {
370388 #[ serde( rename = "const" ) ]
0 commit comments