Closed
Description
Currently we use 3 different ways to serialse enums to json:
- For some of the enums, we use Adjacently tagged
rust/src/rustdoc-json-types/lib.rs
Lines 372 to 423 in 71226d7
Which ends up looking like
"output": {
"inner": {
"lifetime": "'a",
"mutable": false,
"type": {"inner": "i32", "kind": "primitive"}
},
"kind": "borrowed_ref"
}
- For others we use serdes default which is Externally tagged
rust/src/rustdoc-json-types/lib.rs
Lines 322 to 334 in 71226d7
Which gives output that looks like
"params": [
{
"kind": {"lifetime": {"outlives": []}},
"name": "'a"
},
{
"kind": {"type": {"bounds": [], "default": null}},
"name": "T"
}
- Finaly we have the
Item
/ItemEnum
, which are their own special weird, because of Remove Item::kind, use tagged enum. Rename variants to match #82613.
Its basicly Ajacenctly tagged, but the tag/content are inlined to the Item
I'm not sure how much it matters which one we pick as almost all users will be going through the rust types, but it would be good to be consistant. I have no prefernce between 1 and 2, but 3 seems weird, so I dont think we should do that.
cc @CraftSpider
@rustbot modify labels: +C-discussion +A-rustdoc-json +T-rustdoc
but I think 3 is bad