mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-17 02:30:50 +00:00
Merge pull request #809 from Tarnadas/master
doc: Add nightly feature hint for closures
This commit is contained in:
commit
8124cffeba
@ -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
|
||||
|
@ -3,6 +3,8 @@
|
||||
//! This module defines the `Closure` type which is used to pass "owned
|
||||
//! closures" from Rust to JS. Some more details can be found on the `Closure`
|
||||
//! type itself.
|
||||
//!
|
||||
//! The `nightly` feature is required for the `Closure` type to be used.
|
||||
|
||||
use std::cell::UnsafeCell;
|
||||
#[cfg(feature = "nightly")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user