Can't dev rust Cloudflare worker with Wrangler

Hi y’all,

I’m trying to use wrangler dev in my project but Wrangler doesn’t compile because of unresolved import "sys".

What am I doing wrong here? All I tried was add wasm-bindgen-futures to try to make it work with async functions like this

#[wasm_bindgen]
pub async fn send() {}

There are a bunch of other errors like
for reference &std::net::UdpSocket in the current scope
–> /home/vlady/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.34/src/ext.rs:1039:22
|
1039 | set_opt(self.as_sock(), v(IPPROTO_IPV6), IPV6_MULTICAST_HOPS,
| ^^^^^^^ method not found in &std::net::UdpSocket
|
= help: items from traits can only be used if the trait is implemented and in scope
note: ext::AsSock defines an item as_sock, perhaps you need to implement it
–> /home/vlady/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.34/src/ext.rs:654:1
|

I’ve also posted this issue on the rust wasm worker template

Hi @vlady -

Those are compilation errors indicating that certain elements in crates are not available for the wasm32 target. I can see from your Cargo.toml that you are including tokio as a dependency, and this likely brings in some transitive crates that aren’t meant for a wasm32 based environment.