Open inferrna opened 11 months ago
As mentioned in the hello example, we can't depend on hyper-util
in hyper
, because then it becomes a cyclical dependency.
Unless we changed the examples to not be a separate crate, instead of natural examples of hyper.
Ok. Steps to reproduce.
I was succeeded after I googled https://hyper.rs/guides/1/client/basic/, and I would do this faster if there wasn't any README in examples folder (I used to trust README files)
can be closed.
@seanmonstar If hyper can't be used without the code, then maybe it shouldn't live in a separate hyper_util
?
You can have non-Tokio reactors for Hyper, e.g. https://github.com/notgull/smol-hyper
@seanmonstar If hyper can't be used without the code, then maybe it shouldn't live in a separate
hyper_util
?
The whole idea is to allow users to easily choose a reactor for hyper
(while also making it independent of tokio
). tokio
is the one mainly used at the moment, so some common and simple implementations for tokio
with hyper
are provided in the hyper-util
crate instead.
I do agree with the desire for the examples to be immediately usable. Perhaps the best solution is to convert the examples into a crate that's part of the workspace, instead of the crate "examples", and then we can properly depend on hyper-util
in there. Is there a downside I'm not thinking off?
@seanmonstar or perhaps we can point users directly to hyper-util
crate for examples? with a note saying hyper itself is for a lower-level usecase
What are the objections against exposing support::TokioIo
publicly? Having an example which is essentially unusable without depending on a third-party library is very strange, and led to quite a bit of head scratching on my part.
Even though hyper is reactor agnostic, it should have an implementation which works with a rector implementation out of the box. No flexibility is lost, while also allowing new users to Fall into the pit of success
We provided a simple Tokio runtime implementations in hyper-util.
This is not a third-party library, it's maintained by hyper's maintainers.
Thanks, I found it before commenting here. It says This crate is less-stable than hyper
, Which doesn't fill me with confidence.
Should we consider it stable and safe to use with hyper 1.0?
It is safe to use with hyper 1.0.
Currently, one does not simple create own project based on provided examples because almost all examples depends on internal structure TokioIo.
PS: already found
TokioIo
inhyper-util
crate. At least, it should be added to https://github.com/hyperium/hyper/tree/master/examples#dependencies