Nadrieril / dhall-rust

Maintainable configuration files, for Rust users
Other
303 stars 27 forks source link

Make reqwest an optional dependency #178

Closed basile-henry closed 3 years ago

basile-henry commented 3 years ago

This adds a feature to the Cargo.toml to be able to control if dhall depends on reqwest. This makes it possible to build dhall-rust for any arch (not just wasm32) without depending on reqwest.

To disable reqwest as a dependency, we can now use default-features = false when adding the dhall dependency.

Closes #169

Nadrieril commented 3 years ago

Oh, it was that simple ^^ Thanks!

rushsteve1 commented 3 years ago

How would you go about disabling reqwest support from a client application? The feature flag is only exposed on the inner dhall crate, and not on the main serde_dhall crate.

Neither of the following seem to disable reqwest:

serde_dhall = { version = "^0.7", default-features = false }
serde_dhall = "^0.7"
dhall = { version = "*", default-features = false }

Apologies if I've made some obvious mistake.

basile-henry commented 3 years ago

@rushsteve1 You're right, I missed the dependency on dhall in serde_dhall and didn't propagate the feature. To be honest this is the first time I'm playing with these cargo features.

I believe #182 should make your first attempt work:

serde_dhall = { version = "^0.7", default-features = false }

Would you mind checking that works as you expect it? I have tested quickly, but just want to make sure :sweat_smile: