Macro generate_bindings

Source
macro_rules! generate_bindings {
    ($( $x:ty ),*) => { ... };
}
Available on crate feature generating only.
Expand description

Macro to generate javascript and typescript binding strings which can be exported into files.

The supplied structures needs to implement the trait crate::__private::JsBindings. This trait is automatically implemented when deriving the postcard_bindgen_derive::PostcardBindings on the types.

ยงExample

#[derive(Serialize, PostcardBindings)]
struct Test {
    field: u8
}

let bindings = generate_bindings!(Test);