summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dhall/Cargo.toml5
-rw-r--r--dhall/src/semantics/resolve/resolve.rs6
2 files changed, 9 insertions, 2 deletions
diff --git a/dhall/Cargo.toml b/dhall/Cargo.toml
index 6c2c630..72fc13c 100644
--- a/dhall/Cargo.toml
+++ b/dhall/Cargo.toml
@@ -11,6 +11,9 @@ edition = "2018"
build = "build.rs"
include = ["src/**/*", "README.md", "build.rs"]
+[features]
+default = [ "reqwest" ]
+
[[test]]
name = "spec"
harness = false
@@ -33,7 +36,7 @@ url = "2.1"
# Reqwest needs proper async support to work on wasm. So no remote imports on
# wasm for now.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
-reqwest = { version = "0.10", features = ["blocking"] }
+reqwest = { version = "0.10", features = ["blocking"], optional = true }
[dev-dependencies]
anyhow = "1.0.28"
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<String, Error> {
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<String, Error> {
+ panic!("Remote imports are disabled in this build of dhall-rust")
+}
#[cfg(target_arch = "wasm32")]
pub(crate) fn download_http_text(_url: Url) -> Result<String, Error> {
panic!("Remote imports are not supported on wasm yet")