Skip to content

Commit a4e6911

Browse files
committed
1 parent 933c7f0 commit a4e6911

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<a name="v0.22.0"></a>
2+
# [v0.22.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.22.0) - 2023-05-23
3+
- Format Version: 26
4+
- Upstream Commit: [`a5e51013753ca75c239403b47af1e605f5af2a64`](https://github.com/rust-lang/rust/commit/a5e51013753ca75c239403b47af1e605f5af2a64)
5+
- Diff: [v0.22.0...v0.21.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.21.0...v0.22.0)
6+
17
<a name="v0.21.0"></a>
28
# [v0.21.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.21.0) - 2023-05-13
39
- Format Version: 25

COMMIT.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
61e1eda6db042413cf1794407fd10b7edc90059d
1+
a5e51013753ca75c239403b47af1e605f5af2a64

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "rustdoc-types"
3-
version = "0.21.0"
4-
authors = ["Nixon Enraght-Moony <nixon.emoony@gmail.com>", "The Rust Project Developers"]
3+
version = "0.22.0"
54
edition = "2018"
65
license = "MIT OR Apache-2.0"
76
description = "Types for rustdoc's json output"
@@ -12,4 +11,5 @@ repository = "https://github.com/aDotInTheVoid/rustdoc-types/"
1211
serde = {version="1", features=["derive"]}
1312

1413
[dev-dependencies]
14+
bincode = "1.3.3"
1515
serde_json = "1.0"

src/lib.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
88
use std::path::PathBuf;
99

1010
/// rustdoc format-version.
11-
pub const FORMAT_VERSION: u32 = 25;
11+
pub const FORMAT_VERSION: u32 = 26;
1212

1313
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
1414
/// about the language items in the local crate, as well as info about external items to allow
@@ -83,7 +83,6 @@ pub struct Item {
8383
/// Stringified versions of the attributes on this item (e.g. `"#[inline]"`)
8484
pub attrs: Vec<String>,
8585
pub deprecation: Option<Deprecation>,
86-
#[serde(flatten)]
8786
pub inner: ItemEnum,
8887
}
8988

@@ -222,7 +221,7 @@ pub enum ItemKind {
222221
}
223222

224223
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
225-
#[serde(tag = "kind", content = "inner", rename_all = "snake_case")]
224+
#[serde(rename_all = "snake_case")]
226225
pub enum ItemEnum {
227226
Module(Module),
228227
ExternCrate {
@@ -543,7 +542,6 @@ pub enum Term {
543542

544543
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
545544
#[serde(rename_all = "snake_case")]
546-
#[serde(tag = "kind", content = "inner")]
547545
pub enum Type {
548546
/// Structs, enums, and unions
549547
ResolvedPath(Path),

src/tests.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ fn test_struct_info_roundtrip() {
88
impls: vec![],
99
});
1010

11+
// JSON
1112
let struct_json = serde_json::to_string(&s).unwrap();
12-
1313
let de_s = serde_json::from_str(&struct_json).unwrap();
14-
1514
assert_eq!(s, de_s);
15+
16+
// Bincode
17+
let encoded: Vec<u8> = bincode::serialize(&s).unwrap();
18+
let decoded: ItemEnum = bincode::deserialize(&encoded).unwrap();
19+
assert_eq!(s, decoded);
1620
}
1721

1822
#[test]
@@ -24,9 +28,13 @@ fn test_union_info_roundtrip() {
2428
impls: vec![],
2529
});
2630

31+
// JSON
2732
let union_json = serde_json::to_string(&u).unwrap();
28-
2933
let de_u = serde_json::from_str(&union_json).unwrap();
30-
3134
assert_eq!(u, de_u);
35+
36+
// Bincode
37+
let encoded: Vec<u8> = bincode::serialize(&u).unwrap();
38+
let decoded: ItemEnum = bincode::deserialize(&encoded).unwrap();
39+
assert_eq!(u, decoded);
3240
}

0 commit comments

Comments
 (0)