Skip to content

Commit 4c99cf3

Browse files
authored
Turbopack: bincode: Add crate with bincode serialization helpers (#85878)
Add helpers for using bincode with various commonly-used foreign types that do not implement `bincode::Encode`/`bincode::Decode`. We can't implement the bincode traits on these types ourselves because of the orphan rules. This is pulled out of #85878 to make it easier to review. This depends on my fork of bincode here: https://github.com/bgw/bincode/commits/bgw/patches/ Specifically, the `with =` attribute I added here: bgw/bincode@4103717 This behaves like the serde equivalent: https://serde.rs/field-attrs.html#with I am working on trying to get the changes with the bincode fork upstreamed. I submitted a bugfix (bgw/bincode@9247286) via email to the maintainer to start. Upstream is hosted at https://git.sr.ht/~stygianentity/bincode and my fork there is at https://git.sr.ht/~bgw/bincode .
1 parent be0d24a commit 4c99cf3

File tree

4 files changed

+643
-7
lines changed

4 files changed

+643
-7
lines changed

Cargo.lock

Lines changed: 51 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ next-taskless = { path = "crates/next-taskless" }
293293

294294
# Turbopack
295295
auto-hash-map = { path = "turbopack/crates/turbo-tasks-auto-hash-map" }
296+
turbo-bincode = { path = "turbopack/crates/turbo-bincode" }
296297
turbo-prehash = { path = "turbopack/crates/turbo-prehash" }
297298
turbo-rcstr = { path = "turbopack/crates/turbo-rcstr" }
298299
turbo-dyn-eq-hash = { path = "turbopack/crates/turbo-dyn-eq-hash" }
@@ -359,6 +360,7 @@ preset_env_base = "6.0.0"
359360

360361

361362
# General Deps
363+
bincode = { version = "2.0.1", features = ["serde"] }
362364
chromiumoxide = { version = "0.5.4", features = [
363365
"tokio-runtime",
364366
], default-features = false }
@@ -481,4 +483,5 @@ webbrowser = "1.0.6"
481483
inventory = "0.3.21"
482484

483485
[patch.crates-io]
486+
bincode = { git = "https://github.com/bgw/bincode.git", branch = "bgw/patches" }
484487
mdxjs = { git = "https://github.com/mischnic/mdxjs-rs.git", branch = "swc-core-32" }
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "turbo-bincode"
3+
version = "0.0.0"
4+
description = "Utilities for bincode used in turbo-tasks and turbopack"
5+
license = "MIT"
6+
edition = "2024"
7+
8+
[lib]
9+
10+
[lints]
11+
workspace = true
12+
13+
[dependencies]
14+
bincode = { workspace = true }
15+
either = { workspace = true }
16+
indexmap = { workspace = true }
17+
mime = { workspace = true }
18+
ringmap = { workspace = true }
19+
serde = { workspace = true }
20+
serde_json = { workspace = true }
21+
smallvec = { workspace = true }

0 commit comments

Comments
 (0)