Giter VIP home page Giter VIP logo

Comments (12)

Fishrock123 avatar Fishrock123 commented on July 18, 2024 1

I don’t think anything would change other than the removal of the intermediate crate.

from http-client.

bugproof avatar bugproof commented on July 18, 2024 1

Dependency doesn't seem to be optional https://github.com/http-rs/surf/blob/main/Cargo.toml#L67 or maybe I misunderstood something. I'm not that experienced in Rust πŸ˜„

from http-client.

bugproof avatar bugproof commented on July 18, 2024 1

How would this be solved if http-client was merged into Surf? You would need to create a separate surf crates for each HTTP backend no? surf-hyper, surf-curl to solve feature flag situation. Unfortunately feature flags in Cargo aren't solved in very elegant way. I try to avoid using them whenever I can. If you could remove a direct dependency on async-std in Surf then I guess it would be a fine alternative to http-client traits.

The problem with Rust right now is that the async ecosystem is pretty much an opinionated mess and many api client libraries just choose 1 http client for the job, mostly reqwest which uses tokio under the hood.

It doesn't give a lot of freedom with async runtime choice and feature flags is mostly just additional boilerplate code that's hard to maintain. What users of these libraries can do is either move to the supported runtime, write their own library or fork the existing library and replace the runtime or add support to another runtime via feature flags.

from http-client.

yoshuawuyts avatar yoshuawuyts commented on July 18, 2024

Yeah that makes a lot of sense. Do you have a sketch of what that API would look like? I'm still interested in eventually implementing a win32-native HTTP client backend. Getting a sense of what that would look like under this model would be nice.

from http-client.

bugproof avatar bugproof commented on July 18, 2024

Does that mean surf will replace http-client? I'm kind of confused right now.

from http-client.

Fishrock123 avatar Fishrock123 commented on July 18, 2024

Yes

from http-client.

bugproof avatar bugproof commented on July 18, 2024

Oh but Surf only supports async-std. I think that defeats the purpose of http-client crate.

from http-client.

Fishrock123 avatar Fishrock123 commented on July 18, 2024

You can still run surf with the hyper backend...?

from http-client.

Fishrock123 avatar Fishrock123 commented on July 18, 2024

Do you actually use http-client for something that is not Surf and if so, what is it?

from http-client.

bugproof avatar bugproof commented on July 18, 2024

I planned to use it as an abstraction for API client libraries to avoid coupling them to specific async runtime and HTTP client.

from http-client.

Fishrock123 avatar Fishrock123 commented on July 18, 2024

Then you will need to help me maintain http-client. As I said, the feature flag situation with Surf is quite poor right now, and development is just overcomplicated by having this be a separate library.

surf with an http-client-only feature would probably be better or something

from http-client.

sagudev avatar sagudev commented on July 18, 2024

Upcoming Rust 2021 edition will also solve some of feature flags hell. If I am not mistaken resolver 2 can be explicitly used from older versions of rust.

from http-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.