You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Make ChannelTask public, but hidden in documentation
* Added pot as optional dependency
* Add codec documentation to README and extend CI for pot feature
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Pascal Berrang <git@p4l.dev>
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ In contrast to many other libraries like [wasm-bindgen-rayon](https://github.com
11
11
12
12
-[Usage](#usage)
13
13
-[Setting up](#setting-up)
14
+
-[Serialization codec](#serialization-codec)
14
15
-[Outsourcing tasks](#outsourcing-tasks)
15
16
-[WebWorker](#webworker)
16
17
-[WebWorkerPool](#webworkerpool)
@@ -38,6 +39,18 @@ The `wasmworker` crate comes with a default feature called `serde`, which allows
38
39
Without the `serde` feature, only functions with the type `fn(Box<[u8]>) -> Box<[u8]>` can be run on a worker.
39
40
This is useful for users that do not want a direct serde dependency. Internally, the library always uses serde, though.
40
41
42
+
#### Serialization codec
43
+
By default, `wasmworker` uses [postcard](https://crates.io/crates/postcard) for internal serialization.
44
+
Postcard is compact and fast, making it ideal for the typical WebWorker use case (passing `Vec<T>`, structs, primitives).
45
+
46
+
For complex types like `Rc<T>` or cyclic structures, you can use [pot](https://crates.io/crates/pot) instead.
47
+
Note that pot has significantly higher serialization overhead and larger output sizes, so it should only be used when postcard cannot handle your data types.
48
+
49
+
```toml
50
+
[dependencies]
51
+
wasmworker = { version = "0.3", default-features = false, features = ["serde", "macros", "codec-pot"] }
52
+
```
53
+
41
54
You can then start using the library without further setup.
42
55
If you plan on using the global `WebWorkerPool` (using the iterator extensions or `worker_pool()`), you can *optionally* configure this pool:
0 commit comments