diff options
author | Nadrieril Feneanar | 2019-04-14 19:35:57 +0200 |
---|---|---|
committer | GitHub | 2019-04-14 19:35:57 +0200 |
commit | 685dcf6d699a51bae681d0fe605a0cf862f7a37f (patch) | |
tree | 5d7ebd30199eb31f3f2c7e842709bfe9ada901ac /dhall_core | |
parent | 2223c8ff253fe59fcf365c15221f77b1fc86bd3b (diff) | |
parent | e95c0ffe952c504839f924b504fa7c235375cb3b (diff) |
Merge pull request #68 from basile-henry/cache-imports
Cache imports
Diffstat (limited to 'dhall_core')
-rw-r--r-- | dhall_core/src/import.rs | 16 |
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, |