h2 icon indicating copy to clipboard operation
h2 copied to clipboard

Remove tokio I/O traits from dependencies

Open notgull opened this issue 2 years ago • 6 comments

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.

notgull avatar Oct 28 '23 20:10 notgull

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.

seanmonstar avatar Oct 31 '23 13:10 seanmonstar

, 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?

notgull avatar Nov 01 '23 02:11 notgull

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.

seanmonstar avatar Nov 01 '23 13:11 seanmonstar

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

daxpedda avatar Dec 29 '23 21:12 daxpedda