h2 icon indicating copy to clipboard operation
h2 copied to clipboard

Move codec to a separate crate

Open nox opened this issue 2 years ago • 4 comments

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.

nox avatar Oct 20 '21 07:10 nox

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

seanmonstar avatar Oct 20 '21 20:10 seanmonstar

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

nox avatar Oct 21 '21 15:10 nox

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 😃

seanmonstar avatar Oct 21 '21 15:10 seanmonstar

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.

d4h0 avatar Feb 13 '22 14:02 d4h0