Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A synchronous http client for rust? [closed]

Tags:

http

rust

client

I'm looking for a low overhead HTTP client in Rust to create a custom runtime for AWS lambda. All the implementations that I find (including the official runtime from AWS) are based on hyper/tokio and I don't want the overhead nor the added binary weight.

Do you know one ? Is there a reason all frameworks are based on tokio ?

Thanks,

like image 970
MindTailor Avatar asked Oct 17 '22 08:10

MindTailor


1 Answers

Is there a reason all frameworks are based on tokio ?

Tokio crate is contributed by many people and maintained by them as well. Since it is developed and maintained well, It is a wise idea to put new crates on top of this base. This is why many libraries are depending Tokio and it's variant/relevant crates.

Since Tokio is based on minimal sub crates like tokio-tcp, tokio-codec , tokio-io, tokio-executor etc. these crates can be imported seperately so your release size will be considerably small.

If you insist on not using any tokio dependency, there are still some options but they will be developed and maintained by relatively less contributor.

Here are some HTTP Client options which are not using Tokio:

  • Ureq
  • Minreq
  • cHttp
  • easy-http-request (You can try to build http client on top of that)
  • cabot

There are plenty options apart from these alternatives, but in my opinion I import the minimal tokio relevant crates and implement my application on top of them.

like image 135
Akiner Alkan Avatar answered Oct 20 '22 08:10

Akiner Alkan