Postcard Bindgen
This crate allows automatically generating javascript bindings to serialize javascript objects to postcard format and vice versa.
Example
This example shows how to generate a npm package out of the rust
structures. A new folder with the package name will be created. A
javascript file and typescript typings as well as a package.json
will be placed in it.
# use ;
# use Serialize;
# extern crate alloc;
;
// JavaScript
import { serialize } form "test-bindings"
const c = {
tag: "C",
value: [
123,
{
a: 234
}
]
}
const bytes = serialize("C", c)