5 ms·
I don't know how anybody can say this with a straight face. Even in a systems context I think it's pretty reasonable to want to either perform or receive a HTT
by ntr-- 6y ago
I don't know how anybody can say this with a straight face.
Even in a systems context I think it's pretty reasonable to want to either perform or receive a HTTP request, as soon as you do that in Rust you are funneled into Hyper or something built on top of it (like reqwest) and instantly are dependent on tokio/mio.
The very first example in the reqwest readme^1 has tokio attributes, async functions AND trait objects.
It's impossible that a beginner attempting to use the language to do anything related to networking won't be guided into the async nightmare before they have even come to grips with the borrow checker.
1. https://crates.io/crates/reqwest https://crates.io/crates/reqwest
- iso8859-1 6y agojstrong didn't mention anything about beginners or how a typical user is nudged. It's just a description of how they work. They even pointed out which HTTP library they use. There is nothing in their post that requires a curved face.
- rapsey 6y agoYou can avoid async ecosystem with mio_httpc for http client. tiny_http for http server. Both work well.
- thijsc 6y agoTry https://github.com/algesten/ureq https://github.com/algesten/ureq, it’s very nice and not async.
- ogoffart 6y agoReqwest lets you choose between async or not. It has a "blocking" module with a similar API, but no async functions. https://docs.rs/reqwest/0.11.2/reqwest/blocking/index.html https://docs.rs/reqwest/0.11.2/reqwest/blocking/index.html (Maybe this uses async rust under the hood, but you don't have to care about it)
- iso8859-1 6y agoIt is not a question of whether something is blocking or not, blocking is easy. It is a question of whether you can have asynchronicity without await/async. And you can, using mio, as jstrong suggested. You'll manually poll the event loop.