Cannot use JS strings without copying them into wasm memory · Issue #287 · rustwasm/wasm-bindgen (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
This doesn't work, but it should:
#[wasm_bindgen] extern { #[wasm_bindgen(js_name = String)] pub extern type JsString;
pub fn slice(this: &JsString, start: u32, end: u32) -> JsString;
}
This is blocking all the String
related bindings in #275.
I haven't dug in very far, but I think the issue is that strings are special cased by wasm-bindgen to always copy in/out of wasm memory, and so we can't reference them as an opaque extern type.