summaryrefslogtreecommitdiff
path: root/dhall_core/src/import.rs
diff options
context:
space:
mode:
authorNadrieril2019-03-21 20:30:25 +0100
committerNadrieril2019-03-21 20:30:25 +0100
commit6cbe21b84ffd274f92791ab8dbf9af6527978688 (patch)
treef55afb9c14f639350d4186263e6ef9f8d5ba9d76 /dhall_core/src/import.rs
parent845abbb0404ac15cefeca8b6ac32d9b3f93e5987 (diff)
oops
Diffstat (limited to '')
-rw-r--r--dhall_core/src/import.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/dhall_core/src/import.rs b/dhall_core/src/import.rs
new file mode 100644
index 0000000..3e2fbe8
--- /dev/null
+++ b/dhall_core/src/import.rs
@@ -0,0 +1,38 @@
+use std::path::PathBuf;
+
+/// The beginning of a file path which anchors subsequent path components
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum FilePrefix {
+ /// Absolute path
+ Absolute,
+ /// Path relative to .
+ Here,
+ /// Path relative to ..
+ Parent,
+ /// Path relative to ~
+ Home,
+}
+
+/// The location of import (i.e. local vs. remote vs. environment)
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum ImportLocation {
+ Local(FilePrefix, PathBuf),
+ // TODO: other import types
+}
+
+/// How to interpret the import's contents (i.e. as Dhall code or raw text)
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum ImportMode {
+ Code,
+ // TODO
+ // RawText,
+}
+
+/// Reference to an external resource
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct Import {
+ pub mode: ImportMode,
+ pub location: ImportLocation,
+ // TODO
+ pub hash: Option<()>,
+}