Skip to content

Support async_std #331

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

Closed
bahildebrand opened this issue May 22, 2021 · 5 comments
Closed

Support async_std #331

bahildebrand opened this issue May 22, 2021 · 5 comments
Labels
0.4 0.4 release

Comments

@bahildebrand
Copy link
Contributor

#323 exposed a need to support multiple runtimes. This will most likely need be exposed by a new feature flag that would choose between tokio and async_std.

Additionally, there have been calls to support a non-async version(#317). We may be able to kill two birds with one stone here, but the primary focus will be adding support to async_std.

@Fishrock123
Copy link

Fishrock123 commented May 25, 2021

For reference, here is the Tide Listener for lambda that I implemented: https://github.com/Fishrock123/tide-lambda-listener

Ideally this would run on top of something lambda_http, since you can feed http_types::Requests directly into Tide. (Via tide::Server::respond().)

This uses Surf as the http client, using the "h1-client-rustls" feature to have the http-client implementation be backed by async-h1 rather than the still-present-default of libcurl via Isahc (this is planned to change to async-h1 client by default in Surf 3.0). The "unstable-config" feature of http-client is used to gain control over timeouts (as I am the maintainer of http-client, there is a level of stability guarantee here, and it should become stable soon enough).

One note of differences here is that the http_types stack does not allow you to construct Request structs with partial url fragments, instead they must all be complete urls.

Presently it uses the conversions back-and-forth between hyperium http via https://github.com/http-rs/http-types/blob/main/src/hyperium_http.rs to use the http code from this repo (in a patched, exposed form).

async-native-tls and isahc are both avoided to prevent the need for cross-compilation to musl.

@Fishrock123
Copy link

It would probably also be handy (once the time comes) on this end of things to separate source code folders here between hyperium/tokio and http-rs/async-std.

@calavera
Copy link
Contributor

hey folks, we've decided not to do this for the time being. If anything changes, I'll let you know.

@Dgame
Copy link

Dgame commented May 1, 2023

@calavera May I ask how difficult it would be to support this?

@calavera
Copy link
Contributor

calavera commented May 1, 2023

No idea. I'm guessing it's technically possible. Libraries like the AWS SDK only support Tokio too, so the large majority of users will end up using our current async runtime anyways. That's why it's not a goal for this project to support multiple async runtimes at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.4 0.4 release
Projects
None yet
Development

No branches or pull requests

4 participants