Skip to content
New issue

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

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

Already on GitHub? # to your account

TODO: Make cable.rs runtime agnostic #6

Open
mycognosist opened this issue Nov 3, 2023 · 2 comments
Open

TODO: Make cable.rs runtime agnostic #6

mycognosist opened this issue Nov 3, 2023 · 2 comments

Comments

@mycognosist
Copy link
Contributor

mycognosist commented Nov 3, 2023

cable.rs currently uses the async-std runtime. While this was arguably the most approachable async codebase at the time when cable.rs was first written, it has largely been eclipsed in popularity by tokio.

If downstream users of cable.rs are building an application that uses the tokio runtime in some part of their stack, they end up having to run a second async runtime for async-std. This is obviously not ideal.

We can either refactor cable.rs to make it runtime agnostic, in which case it can run with either the async-std or tokio runtime, or we can switch to tokio instead.

CC: @ahdinosaur

@mycognosist
Copy link
Contributor Author

A third possibility: make cable.rs entirely synchronous, removing the need for an async runtime. This would have the benefit of making the code much simpler, with little-to-no performance cost.

The length-prefixed-stream crate would need to be refactored. I'm not particularly knowledgeable when it comes to that code so I'd have to take a careful look first to ensure that a synchronous refactor is feasible.

Useful reading on the topic by Matthias Endler: The State of Async Rust: Runtimes.

@mycognosist
Copy link
Contributor Author

I've completed an async-runtime agnostic refactor of length-prefixed-stream; will open a PR in due course. That should clear the way for the rest of the refactor :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant