rust - 是否可以让 wasm-bindgen 忽略 impl 中的某些公共(public)功能?

标签 rust

是否可以让 wasm-bindgen 在 impl 中忽略(不生成绑定(bind))某些公共(public)函数?我有一个 impl,我希望一些公共(public)函数具有绑定(bind),但其他公共(public)函数我不希望绑定(bind)。

最佳答案

是的,您可以使用多个 impl block 并添加 #[wasm_bindgen]选择性地。

impl Foo {
    // pub fns internal to library
}

#[wasm_bindgen]
impl Foo {
    // pub fns to export to JS
}

关于rust - 是否可以让 wasm-bindgen 忽略 impl 中的某些公共(public)功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51388721/

相关文章:

rust - 如何将数据从 csv::StringRecord 推送到结构中的每个列向量?

linux - 从Fedora Linux主机到Windows目标的交叉编译Rust找不到依赖项

rust - 为什么我的 Future 实现一开始就陷入困境?

multithreading - 在异步 block 中使用线程不安全值

rust - 首先获取迭代器的所有内容。在使用rust

rust - 所有权可以自动转移回来吗?

Rust 示例 : The ref pattern

for-loop - Rust 中 for 循环的命名中断

rust - 如何用 Vec 支持 HashMap

rust - 如何在WASM-Bindgen和Rust中实际获取响应正文的文本