Skip to content

Commit a39b1d8

Browse files
committed
Compiled with new dependencies and removed old modules
1 parent 64c812a commit a39b1d8

File tree

14 files changed

+114
-872
lines changed

14 files changed

+114
-872
lines changed

.vim/coc-settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
3+
"rust-analyzer.checkOnSave.target": "wasm32-unknown-unknown"
4+
}

Cargo.toml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
[package]
2-
name = "wasm-timer"
3-
edition = "2018"
2+
name = "wasmtimer"
3+
edition = "2021"
44
description = "Abstraction over std::time::Instant and futures-timer that works on WASM"
5-
version = "0.2.5"
6-
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
5+
version = "0.0.1"
6+
authors = ["WhizSid <whizsid@aol.com>"]
77
license = "MIT"
8-
repository = "https://github.com/tomaka/wasm-timer"
8+
repository = "https://github.com/whizsid/wasmtimer-rs"
99

1010
[dependencies]
11-
futures = "0.3.1"
12-
parking_lot = "0.11"
11+
futures = "0.3"
12+
parking_lot = "0.12"
1313
pin-utils = "0.1.0"
14-
15-
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
16-
js-sys = "0.3.31"
17-
wasm-bindgen = "0.2.37"
18-
wasm-bindgen-futures = "0.4.4"
19-
web-sys = { version = "0.3.31", features = ["Performance", "Window"] }
14+
js-sys = "0.3"
15+
wasm-bindgen = "0.2"
16+
wasm-bindgen-futures = "0.4"
17+
web-sys = { version = "0.3", features = ["Performance", "Window"] }
2018

2119
[dev-dependencies]
2220
async-std = "1.0"

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
# Wasm-timer
1+
# wasmtimer-rs
22

3-
Exports the `Instant`, `Delay`, `Interval` and `Timeout` structs.
3+
An implementation of `time` based functionalities from `std::time`, `tokio::time`,
4+
`tokio_util::time` for WASM targets. This crate tries to closely
5+
replicate above APIs. Users only have to change their `use` scripts by
6+
using a `cfg` macro.
47

5-
On non-WASM targets, this re-exports the types from `tokio-timer`.
6-
On WASM targets, this uses `web-sys` to implement their functionalities.
8+
```rust
9+
#[cfg(not(target_arch="wasm"))]
10+
use tokio::time::*;
11+
#[cfg(target_arch="wasm")]
12+
use wasmtimer::tokio::*;
13+
```
14+
15+
Check the [API Documentation](https://docs.rs/wasmtimer) for more
16+
details.

src/lib.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@
1717
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1818
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1919
// DEALINGS IN THE SOFTWARE.
20-
21-
pub use timer::*;
22-
23-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
24-
pub use std::time::{Instant, SystemTime, UNIX_EPOCH};
25-
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
26-
pub use wasm::*;
27-
28-
mod timer;
29-
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
30-
mod wasm;
20+
pub(crate) mod timer;
21+
pub mod std;
22+
pub mod tokio;

src/wasm.rs renamed to src/std.rs

File renamed without changes.

src/timer/delay.rs

Lines changed: 0 additions & 208 deletions
This file was deleted.

0 commit comments

Comments
 (0)