< 返回版块

xzzy 发表于 2023-07-06 23:06

#[wasm_bindgen]
#[derive(Debug, Clone, Copy)]
pub struct End;

#[wasm_bindgen]
#[derive(Debug)]
pub struct Data {
    pub end: End,
    pub value: LinkedHashMap<String, Box<dyn MOC>>,
}

#[wasm_bindgen]
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct String {
    pub length: u16,
    pub value: std::string::String,
}

impl MOC for End {
    //snip
}

impl MOC for Data {
    //snip
}

impl MOC for String {
    //snip
}

如何将Data结构体导出为JS对象?(不需要包含特征的实现)

评论区

写评论
github.com/shanliu/lsys 2023-07-07 20:42

serde_json

1 共 1 条评论, 1 页