wiremock-rs icon indicating copy to clipboard operation
wiremock-rs copied to clipboard

Implicit use of `tokio::net`

Open elpiel opened this issue 1 year ago • 3 comments

Seems that the features is enabled by hyper_util but it's not enabled on this crate even though it's being used.

I was exploring the option to make wiremock wasm-unknown-unknown happy but sadly hyper_util doesn't allow it because it relies on tokio net which relies on mio. And mio only supports the wasm-wasi (there are OS socket after all)

While socket2 is not actually mandatory for the tokio feature itself but clien-legacy in hyper_util.

PS: Would be nice to enable resolver = "2" as well.

elpiel avatar Feb 29 '24 15:02 elpiel

I'm open to the idea of making changes to enable easier usage in a WASM context. What would that entail?

PS: Would be nice to enable resolver = "2" as well.

That only affects the project you're currently building. Having it set on wiremock makes no sense difference for downstream users AFAIK.

LukeMathWalker avatar Feb 29 '24 15:02 LukeMathWalker

I believe for WASM support we should target wasm32-wasi as it provides access to some OS resources. The main issue I suppose is the Tcp socket where currently tokio::net is used and, in terms, mio. But I haven't done much research on the topic so it must be more thoroughly checked.

as for the resolver, yes, you are right. features only show on the first occurrence of a given dependency in cargo tree and I had to hunt down which dep. enables a tokio features that requires mio

elpiel avatar Mar 01 '24 07:03 elpiel

And btw mio supports wasm32-wasi and TcpListener/TcpStream: https://docs.rs/mio/latest/wasm32-wasi/mio/net/index.html

Not sure if tokio will play nice though..

And wasm-bindgen doesn't support the target as well :/

elpiel avatar Mar 01 '24 07:03 elpiel