From 11ff1d502d5706b92e09a4051f7ffc708859409c Mon Sep 17 00:00:00 2001 From: Basile Henry Date: Sat, 10 Oct 2020 12:36:51 +0200 Subject: Make reqwest an optional dependency 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 --- dhall/src/semantics/resolve/resolve.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'dhall/src/semantics') diff --git a/dhall/src/semantics/resolve/resolve.rs b/dhall/src/semantics/resolve/resolve.rs index 036e9a0..2b401dc 100644 --- a/dhall/src/semantics/resolve/resolve.rs +++ b/dhall/src/semantics/resolve/resolve.rs @@ -197,10 +197,14 @@ fn mkexpr(kind: UnspannedExpr) -> Expr { } // TODO: error handling -#[cfg(not(target_arch = "wasm32"))] +#[cfg(all(not(target_arch = "wasm32"), feature = "reqwest"))] pub(crate) fn download_http_text(url: Url) -> Result { Ok(reqwest::blocking::get(url).unwrap().text().unwrap()) } +#[cfg(all(not(target_arch = "wasm32"), not(feature = "reqwest")))] +pub(crate) fn download_http_text(_url: Url) -> Result { + panic!("Remote imports are disabled in this build of dhall-rust") +} #[cfg(target_arch = "wasm32")] pub(crate) fn download_http_text(_url: Url) -> Result { panic!("Remote imports are not supported on wasm yet") -- cgit v1.2.3