Skip to content

Commit

Permalink
1.0.0-beta.14: Use web-time on wasm32 targets
Browse files Browse the repository at this point in the history
  • Loading branch information
DoumanAsh committed Jun 25, 2024
1 parent b02a1f9 commit 73ad341
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "async-timer"
version = "1.0.0-beta.13"
version = "1.0.0-beta.14"
authors = ["Douman <[email protected]>"]
edition = "2018"
description = "Timers for Rust async story"
Expand Down Expand Up @@ -34,6 +34,7 @@ tokio_1 = { package = "tokio", version = "1.35", default-features = false, optio

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

[dev-dependencies]
tokio_1 = { package = "tokio", version = "1.35", default-features = false, features = ["macros", "rt"] }
Expand Down
3 changes: 3 additions & 0 deletions src/interval.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//!Interval module

#[cfg(not(target_arch = "wasm32"))]
use std::time;
#[cfg(target_arch = "wasm32")]
use web_time as time;
use core::task;
use core::future::Future;
use core::pin::Pin;
Expand Down
2 changes: 1 addition & 1 deletion src/timer/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl Drop for WebTimer {
State::Running(ref mut fd, state) => unsafe {
(*state).cancel();
fd.clear();
Box::from_raw(state as *mut TimerState);
let _ = Box::from_raw(state as *mut TimerState);
},
_ => (),
}
Expand Down

0 comments on commit 73ad341

Please sign in to comment.