reqwest
reqwest copied to clipboard
unable to work with tokio in wasm32-unknown-unkown
[target.'cfg(target_arch = "wasm32")'.dependencies]
reqwest = { version ="0.11", default-features = false, features = ["rustls-tls", "json"] }
tokio = { version = "1.0", default-features = false, features = ["net", "time"] }
If both tokio
and reqwest
dependencies exist, cargo build --target wasm32-unknown-unknown
failed.
error[E0583]: file not found for module `sys`
--> /rust/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/lib.rs:124:1
|
124 | mod sys;
| ^^^^^^^^
|
= help: to create the module `sys`, create file "/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys.rs" or "/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/mod.rs"
error: Socket2 doesn't support the compile target
--> /rust/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/lib.rs:127:1
|
127 | compile_error!("Socket2 doesn't support the compile target");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0432]: unresolved imports `crate::sys::sa_family_t`, `crate::sys::sockaddr`, `crate::sys::sockaddr_in`, `crate::sys::sockaddr_in6`, `crate::sys::sockaddr_storage`, `crate::sys::socklen_t`, `crate::sys::AF_INET`, `crate::sys::AF_INET6`
--> /rust/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sockaddr.rs:6:5