hyperium / h2

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

Move codec to a separate crate #568

Open nox opened 2 years ago

nox commented 2 years ago

If we move the codec stuff (wire format, frames, decoding…) to a separate crate, we don't need to expose an unstable feature and the tests won't need to reach into public-but-hidden methods.

seanmonstar commented 2 years ago

Eh, almost seems like more hassle than it's worth, at least to me. 🤷‍♂️

nox commented 2 years ago

But you wouldn't mind if I take care of the hassle, then? :)

seanmonstar commented 2 years ago

I think there's also a maintenance cost to separating them. Keeping it in-crate allows other internal parts to access private details. Is there another thing that you hope to gain? I'd probably rather suggest, if need be, we see if can make the codec part of the library public. But hopefully for more than helping the test suite 😃

d4h0 commented 2 years ago

Would this make it possible to use this separate codec crate to build clients/servers that are not async?

I think, this would be amazing (for example, for building a client/server that sits directly on top of MIO, like mio_httpc (which currently doesn't implement HTTP 2), or when implementing an HTTP 2 client/server for an actor framework like Stakker. This could be interesting for performance reasons).

Or, probably more interesting, to build a blocking client/server (this could be interesting, for example, for security reasons, because sync clients/servers normally would be much simpler to implement and require fewer dependencies, compared to a high-performance async alternative).

Alternatively, maybe exposing the codec stuff and making the async parts a default feature would work too.