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

PollWatcher on wasm32-unknown-unknown target not possible with time not implemented. #474

Open
CATboardBETA opened this issue Mar 29, 2023 · 0 comments
Labels
A-enhancement os-wasm WASM related Z-needs implementation Needs an implementation, will accept PRs

Comments

@CATboardBETA
Copy link

CATboardBETA commented Mar 29, 2023

System details

  • OS/Platform name and version: host aarch64-apple-darwin; target wasm32-unknown-unknown
  • Rust version (if building from source): rustc --version: 1.67.0
  • Notify version (or commit hash if building from git): 5.1.0
  • If you're running as a privileged user (root, System): Admin

What you did (as detailed as you can)

I created a PollWatcher (either with RecommendedWatcher or directly), with any duration, and no matter what, get the error in my web console panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:13:9

What you expected

A method for notify to function on wasm32-unknown-unknown, or an alternative library.

What happened

It threw the error panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:13:9

Possible fix

I think this would be fixable with a feature wasm that replaces all uses std::time::Instant internally with Instant from this lib: sebcrozet/instant. It has features, and if you don't enable them it will just be a type alias to std::time::Instant::now. Note that I haven't done much look into the implementation of notify, this is purely a suggestion.

@0xpr03 0xpr03 added A-enhancement Z-needs implementation Needs an implementation, will accept PRs os-wasm WASM related labels Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-enhancement os-wasm WASM related Z-needs implementation Needs an implementation, will accept PRs
Projects
None yet
Development

No branches or pull requests

2 participants