summaryrefslogtreecommitdiff
path: root/dhall_core
diff options
context:
space:
mode:
authorBasile Henry2019-04-12 09:32:56 +0200
committerBasile Henry2019-04-14 17:27:32 +0200
commite95c0ffe952c504839f924b504fa7c235375cb3b (patch)
tree5404a33a0106c71ff5c53877b46022905652d6f9 /dhall_core
parent7aaa3f1747e6012e51e67edb268414e2c2fb51cd (diff)
Cache imports
Diffstat (limited to 'dhall_core')
-rw-r--r--dhall_core/src/import.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/dhall_core/src/import.rs b/dhall_core/src/import.rs
index f039953..00f293c 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, Copy, Clone, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum FilePrefix {
/// Absolute path
Absolute,
@@ -14,7 +14,7 @@ pub enum FilePrefix {
}
/// The location of import (i.e. local vs. remote vs. environment)
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ImportLocation {
Local(FilePrefix, PathBuf),
Remote(URL),
@@ -22,7 +22,7 @@ pub enum ImportLocation {
Missing,
}
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct URL {
pub scheme: Scheme,
pub authority: String,
@@ -31,33 +31,33 @@ pub struct URL {
pub headers: Option<Box<ImportHashed>>,
}
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
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)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum ImportMode {
Code,
RawText,
}
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Hash {
pub protocol: String,
pub hash: String,
}
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ImportHashed {
pub location: ImportLocation,
pub hash: Option<Hash>,
}
/// Reference to an external resource
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Import {
pub mode: ImportMode,
pub location_hashed: ImportHashed,