rs2js

Crates.iors2js
lib.rsrs2js
version0.2.3
sourcesrc
created_at2023-05-02 13:23:50.054246
updated_at2023-06-13 14:00:23.792852
descriptionA macro to convert Rust structs to/from JsValues
homepage
repositoryhttps://github.com/AmbientRun/Rs2Js
max_upload_size
id854554
size2,784
Fredrik Norén (FredrikNoren)

documentation

README

Rs2Js: Rust to JsValue and back again

Usage

#[derive(Rs2Js, Debug, Clone, PartialEq)]
pub struct DbProject {
    pub name: String,
    pub owner_id: String,
    pub created: Timestamp,
}
fn main() {
    let proj = DbProject { .. };
    let value = proj.to_js(); // JsValue
}

Motivation

This mostly exists because serde-wasm-bindgen currently doesn't support passing through JsValues (see this issue).

Commit count: 12

cargo fmt