When parking_lot
is used in a wasm
context, sometimes we run into an error with the unknwon
target
failed to resolve import `env::now`
The solution is here: Amanieu/parking_lot#269 (comment)
While you can lock parking_lot_core to anything below 0.8.1 (uses the InstantDummy) I would not recommend this. Instead I'd recommend to enable the necessary features transitively when using wasm-bindgen. That means for instant to work on wasm32 you have to enable the wasm-bindgen feature and depending on the platform and whether performance.now() is available, you also need to enable inaccurate.
To fix the issue add instant as a dependency to your own crate and enable the features mentioned above:
[features]
# `instant/wasm-bindgen` makes sure it will use `js_sys` for getting the system time
# `instant/inaccurate` uses `Date.now()` instead of `performance.now()`
default = ["instant/wasm-bindgen", "instant/inaccurate"]
[dependencies]
instant = "0.1.12"