hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.34k stars 266 forks source link

Remove tokio I/O traits from dependencies #720

Open notgull opened 8 months ago

notgull commented 8 months ago

Would it be accepted to replace the tokio I/O traits with more general I/O traits, like what happened in hyper? If so, I can implement this.

seanmonstar commented 8 months ago

I think this is something we could do, though it would be a breaking change and highlighting why it's worth it, and also how we would track the differences with hyper, would be good to do.

notgull commented 8 months ago

, though it would be a breaking change and highlighting why it's worth it

It would enable usage of hyper and h2 in runtimes that aren't tokio.

also how we would track the differences with hyper,

Maybe we can extract the hyper traits into a separate crate?

seanmonstar commented 8 months ago

Hm. It's already been possible to use hyper and h2 with different runtimes. I've seen hyper 0.14 work with curl, async-std, and Fuchsia. Using just the traits from Tokio doesn't make it use the runtime, or even enable all the runtime code. The reason why hyper made its own traits was to be able to update them independently for eventual io-uring upgrades. I don't really want to extract those traits to a separate crate, I don't mean for them to be used throughout the ecosystem. They're just how to hook into hyper.

That said, I do still think this is something that could be done for h2, with other motivations brought up.

daxpedda commented 6 months ago

I think the idea is to not bring in Tokio as a dependency at all while still being able to use h2.