diff options
author | Nadrieril | 2020-03-04 21:26:01 +0000 |
---|---|---|
committer | Nadrieril | 2020-03-05 15:58:54 +0000 |
commit | 903d6c0bba36a6696eb337ae84b962f4cc48b5b5 (patch) | |
tree | 63cb58b2b566fb5532e59b1455fffc82fa89ce0d /dhall/src/syntax/ast | |
parent | 5a9a5859eec0cf7deebf7fa07fe99f8dc8722ec8 (diff) |
Implement remote imports and cleanup import chaining
Diffstat (limited to 'dhall/src/syntax/ast')
-rw-r--r-- | dhall/src/syntax/ast/import.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/dhall/src/syntax/ast/import.rs b/dhall/src/syntax/ast/import.rs index 7bde6e0..75d7946 100644 --- a/dhall/src/syntax/ast/import.rs +++ b/dhall/src/syntax/ast/import.rs @@ -18,7 +18,7 @@ pub struct FilePath { /// The location of import (i.e. local vs. remote vs. environment) #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum ImportLocation<SubExpr> { +pub enum ImportTarget<SubExpr> { Local(FilePrefix, FilePath), Remote(URL<SubExpr>), Env(String), @@ -57,7 +57,7 @@ pub enum Hash { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Import<SubExpr> { pub mode: ImportMode, - pub location: ImportLocation<SubExpr>, + pub location: ImportTarget<SubExpr>, pub hash: Option<Hash>, } @@ -77,12 +77,12 @@ impl<SE> URL<SE> { } } -impl<SE> ImportLocation<SE> { +impl<SE> ImportTarget<SE> { pub fn traverse_ref<'a, Err, SE2>( &'a self, f: impl FnOnce(&'a SE) -> Result<SE2, Err>, - ) -> Result<ImportLocation<SE2>, Err> { - use ImportLocation::*; + ) -> Result<ImportTarget<SE2>, Err> { + use ImportTarget::*; Ok(match self { Local(prefix, path) => Local(*prefix, path.clone()), Remote(url) => Remote(url.traverse_ref(f)?), |