Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit use of tokio::net #141

Open
elpiel opened this issue Feb 29, 2024 · 3 comments
Open

Implicit use of tokio::net #141

elpiel opened this issue Feb 29, 2024 · 3 comments

Comments

@elpiel
Copy link

elpiel commented Feb 29, 2024

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.

@LukeMathWalker
Copy link
Owner

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.

@elpiel
Copy link
Author

elpiel commented Mar 1, 2024

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
Copy link
Author

elpiel commented Mar 1, 2024

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 elpiel changed the title Implicit use of tokio::net Implicit use of tokio::net Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants