mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-15 04:23:12 +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 {
|
||||
pub fn new<F>(millis: u32, f: F) -> Interval
|
||||
pub fn new<F: 'static>(millis: u32, f: F) -> Interval
|
||||
where
|
||||
F: FnMut()
|
||||
{
|
||||
@ -119,6 +119,6 @@ impl Drop for Interval {
|
||||
// Keep logging "hello" every second until the resulting `Interval` is dropped.
|
||||
#[wasm_bindgen]
|
||||
pub fn hello() -> Interval {
|
||||
Interval::new(1_000, || log("hello"));
|
||||
Interval::new(1_000, || log("hello"))
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user