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

[experiment / RFC] runtime-agnostic async API #1648

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

japaric
Copy link
Contributor

@japaric japaric commented Nov 30, 2023

This PR contains an async adapter that works with both async-std and tokio but depends on neither crate. Instead it uses the futures::Async{Read,Write} interfaces to make the API, runtime generic.

  • this is just a sketch (= I have not done extensive testing)
  • the sketch only includes the client API
  • a client example that can use either async-std or tokio is included
  • there are no API docs but the API surface mimics the high level async API found in rustls-tokio
  • the API is not no-std compatible because the Async{Read,Write} traits include the std::io::Error type in its interface
  • the async API is implemented on top of the UnbufferedConnection API

@cpu
Copy link
Member

cpu commented Dec 15, 2023

@quininer If you had time this branch might be interesting to you as someone that has done a lot of work on rustls-tokio. Any feedback you could share would be helpful !

@quininer
Copy link
Member

This looks great, I have plans to use it in tokio-rustls, futures-rustls after UnbufferedConnection is released.

The async crate has a lot of TODOs, but i think direction is fine.

@joshtriplett
Copy link
Contributor

Suggestion: rather than using the full futures, consider using futures-io (https://crates.io/crates/futures-io), to reduce dependencies for people who don't need the full futures.

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

Successfully merging this pull request may close these issues.

None yet

4 participants