Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,15 @@ dependencies = [
"cc",
]

[[package]]
name = "cobs"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1"
dependencies = [
"thiserror 2.0.17",
]

[[package]]
name = "codespan-reporting"
version = "0.13.1"
Expand Down Expand Up @@ -1330,6 +1339,18 @@ dependencies = [
"stable_deref_trait",
]

[[package]]
name = "embedded-io"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced"

[[package]]
name = "embedded-io"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"

[[package]]
name = "ena"
version = "0.14.3"
Expand Down Expand Up @@ -3055,6 +3076,18 @@ dependencies = [
"portable-atomic",
]

[[package]]
name = "postcard"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24"
dependencies = [
"cobs",
"embedded-io 0.4.0",
"embedded-io 0.6.1",
"serde",
]

[[package]]
name = "potential_utf"
version = "0.1.4"
Expand Down Expand Up @@ -4978,7 +5011,7 @@ dependencies = [
name = "rustdoc-json-types"
version = "0.1.0"
dependencies = [
"bincode",
"postcard",
"rkyv",
"rustc-hash 2.1.1",
"serde",
Expand Down
2 changes: 1 addition & 1 deletion src/rustdoc-json-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ rkyv = { version = "0.8", optional = true }

[dev-dependencies]
serde_json = "1.0"
bincode = "1"
postcard = { version = "1", default-features = false, features = ["alloc"] }
14 changes: 7 additions & 7 deletions src/rustdoc-json-types/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ fn test_struct_info_roundtrip() {
let de_s = serde_json::from_str(&struct_json).unwrap();
assert_eq!(s, de_s);

// Bincode
let encoded: Vec<u8> = bincode::serialize(&s).unwrap();
let decoded: ItemEnum = bincode::deserialize(&encoded).unwrap();
// Postcard
let encoded: Vec<u8> = postcard::to_allocvec(&s).unwrap();
let decoded: ItemEnum = postcard::from_bytes(&encoded).unwrap();
assert_eq!(s, decoded);
}

Expand All @@ -33,9 +33,9 @@ fn test_union_info_roundtrip() {
let de_u = serde_json::from_str(&union_json).unwrap();
assert_eq!(u, de_u);

// Bincode
let encoded: Vec<u8> = bincode::serialize(&u).unwrap();
let decoded: ItemEnum = bincode::deserialize(&encoded).unwrap();
// Postcard
let encoded: Vec<u8> = postcard::to_allocvec(&u).unwrap();
let decoded: ItemEnum = postcard::from_bytes(&encoded).unwrap();
assert_eq!(u, decoded);
}

Expand All @@ -59,7 +59,7 @@ mod rkyv {
/// A test to exercise the (de)serialization roundtrip for a representative selection of types,
/// covering most of the rkyv-specific attributes we had to had.
fn test_rkyv_roundtrip() {
// Standard derives: a plain struct and union, mirroring the existing serde/bincode tests.
// Standard derives: a plain struct and union, mirroring the existing serde/postcard tests.
let s = ItemEnum::Struct(Struct {
generics: Generics { params: vec![], where_predicates: vec![] },
kind: StructKind::Plain { fields: vec![Id(1), Id(2)], has_stripped_fields: false },
Expand Down
Loading