ihrwein / backoff

Exponential backoff and retry for Rust.
https://github.com/ihrwein/backoff
Apache License 2.0
306 stars 37 forks source link

getrandom requires js future #52

Open ycuk opened 2 years ago

ycuk commented 2 years ago

I try to use dependency backoff = { version = "0.4.0", futures = ["wasm-bindgen"] }

error: the wasm32-unknown-unknown target is not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
   --> /Users/ycuk/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.3/src/lib.rs:219:9
    |
219 | /         compile_error!("the wasm32-unknown-unknown target is not supported by \
220 | |                         default, you may need to enable the \"js\" feature. \
221 | |                         For more information see: \
222 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |_________________________________________________________________________^

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /Users/ycuk/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.3/src/lib.rs:246:5
    |
246 |     imp::getrandom_inner(dest)
    |     ^^^ use of undeclared crate or module `imp`

After clone repo and replace, it works well:

-getrandom = "0.2"
+getrandom = { version = "0.2", features = ["js"] }