mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2025-01-07 13:43:03 +03:00
Fix closure example compilation errors
This commit is contained in:
parent
0cbdea5fa9
commit
c043a952a2
@ -95,7 +95,7 @@ pub struct Interval {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Interval {
|
impl Interval {
|
||||||
pub fn new<F>(millis: u32, f: F) -> Interval
|
pub fn new<F: 'static>(millis: u32, f: F) -> Interval
|
||||||
where
|
where
|
||||||
F: FnMut()
|
F: FnMut()
|
||||||
{
|
{
|
||||||
@ -119,6 +119,6 @@ impl Drop for Interval {
|
|||||||
// Keep logging "hello" every second until the resulting `Interval` is dropped.
|
// Keep logging "hello" every second until the resulting `Interval` is dropped.
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn hello() -> Interval {
|
pub fn hello() -> Interval {
|
||||||
Interval::new(1_000, || log("hello"));
|
Interval::new(1_000, || log("hello"))
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user