summaryrefslogtreecommitdiff
path: root/dhall_core/src/import.rs
diff options
context:
space:
mode:
authorNadrieril2019-03-22 00:01:30 +0100
committerNadrieril2019-03-22 00:01:30 +0100
commitfe38fd6a8859447a154a5698a3e21d9203262be2 (patch)
tree814b0db038315f4b193374a9f5f9e672941bb0c3 /dhall_core/src/import.rs
parent66e7c7750844bc976f23616c4a0103e778bdf4bd (diff)
Parse a lot more of the import types
Diffstat (limited to '')
-rw-r--r--dhall_core/src/import.rs26
1 files changed, 21 insertions, 5 deletions
diff --git a/dhall_core/src/import.rs b/dhall_core/src/import.rs
index 3e2fbe8..21bd370 100644
--- a/dhall_core/src/import.rs
+++ b/dhall_core/src/import.rs
@@ -1,7 +1,7 @@
use std::path::PathBuf;
/// The beginning of a file path which anchors subsequent path components
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum FilePrefix {
/// Absolute path
Absolute,
@@ -17,15 +17,31 @@ pub enum FilePrefix {
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ImportLocation {
Local(FilePrefix, PathBuf),
- // TODO: other import types
+ Remote(URL),
+ Env(String),
+ Missing,
}
-/// How to interpret the import's contents (i.e. as Dhall code or raw text)
#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct URL {
+ pub scheme: Scheme,
+ pub authority: String,
+ pub path: PathBuf,
+ pub query: Option<String>,
+ // pub headers: Option<ImportHashed>,
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub enum Scheme {
+ HTTP,
+ HTTPS,
+}
+
+/// How to interpret the import's contents (i.e. as Dhall code or raw text)
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum ImportMode {
Code,
- // TODO
- // RawText,
+ RawText,
}
/// Reference to an external resource