Skip to content

Commit 73ad341

Browse files
committed
1.0.0-beta.14: Use web-time on wasm32 targets
1 parent b02a1f9 commit 73ad341

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "async-timer"
3-
version = "1.0.0-beta.13"
3+
version = "1.0.0-beta.14"
44
authors = ["Douman <[email protected]>"]
55
edition = "2018"
66
description = "Timers for Rust async story"
@@ -34,6 +34,7 @@ tokio_1 = { package = "tokio", version = "1.35", default-features = false, optio
3434

3535
[target.'cfg(any(target_arch = "wasm32"))'.dependencies]
3636
wasm-bindgen = "0.2"
37+
web-time = "1.1"
3738

3839
[dev-dependencies]
3940
tokio_1 = { package = "tokio", version = "1.35", default-features = false, features = ["macros", "rt"] }

src/interval.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
//!Interval module
22
3+
#[cfg(not(target_arch = "wasm32"))]
34
use std::time;
5+
#[cfg(target_arch = "wasm32")]
6+
use web_time as time;
47
use core::task;
58
use core::future::Future;
69
use core::pin::Pin;

src/timer/web.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl Drop for WebTimer {
169169
State::Running(ref mut fd, state) => unsafe {
170170
(*state).cancel();
171171
fd.clear();
172-
Box::from_raw(state as *mut TimerState);
172+
let _ = Box::from_raw(state as *mut TimerState);
173173
},
174174
_ => (),
175175
}

0 commit comments

Comments
 (0)