mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-22 09:11:35 +00:00
@ -63,6 +63,12 @@ return but the JavaScript closure still needs to be valid!
|
||||
For this scenario, you need the `Closure` type, which is defined in the
|
||||
`wasm_bindgen` crate, exported in `wasm_bindgen::prelude`, and represents a
|
||||
"long lived" closure.
|
||||
The `Closure` type is currently behind a feature which needs to be enabled:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
wasm-bindgen = {version = "^0.2", features = ["nightly"]}
|
||||
```
|
||||
|
||||
The validity of the JavaScript closure is tied to the lifetime of the `Closure`
|
||||
in Rust. **Once a `Closure` is dropped, it will deallocate its internal memory
|
||||
|
Reference in New Issue
Block a user