Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web timer support #153

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
- run: rustup target add wasm32-unknown-unknown
- run: cargo build --all --all-features --all-targets
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
if: startsWith(matrix.rust, 'nightly')
Expand All @@ -50,6 +51,9 @@ jobs:
# if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
# run: cargo check -Z build-std --target=riscv32imc-esp-espidf
- run: cargo test
- uses: taiki-e/install-action@wasm-pack
- run: cargo check --target wasm32-unknown-unknown --all-features --tests
- run: wasm-pack test --node

# Copied from: https://github.com/rust-lang/stacker/pull/19/files
windows_gnu:
Expand Down
19 changes: 17 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ name = "timer"
harness = false

[dependencies]
async-lock = "2.6"
cfg-if = "1"
futures-lite = { version = "1.11.0", default-features = false }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
async-lock = "2.6"
concurrent-queue = "2.2.0"
futures-io = { version = "0.3.28", default-features = false, features = ["std"] }
futures-lite = { version = "1.11.0", default-features = false }
parking = "2.0.0"
polling = "3.0.0"
rustix = { version = "0.38.2", default-features = false, features = ["std", "fs"] }
Expand All @@ -36,15 +38,28 @@ socket2 = { version = "0.5.3", features = ["all"] }
tracing = { version = "0.1.37", default-features = false }
waker-fn = "1.1.0"

[target.'cfg(target_family = "wasm")'.dependencies]
atomic-waker = "1.1.1"
wasm-bindgen = "0.2.87"
web-sys = { version = "0.3.0", features = ["Window"] }

[dev-dependencies]
async-channel = "1"

[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
async-net = "1"
blocking = "1"
criterion = { version = "0.4", default-features = false, features = ["cargo_bench_support"] }
getrandom = "0.2.7"
signal-hook = "0.3"
tempfile = "3"

[target.'cfg(target_family = "wasm")'.dev-dependencies]
console_error_panic_hook = "0.1.7"
wasm-bindgen-futures = "0.4.37"
wasm-bindgen-test = "0.3.37"
web-time = "0.2.0"

[target.'cfg(target_os = "linux")'.dev-dependencies]
inotify = { version = "0.10.1", default-features = false }
timerfd = "1"
Expand Down