From fe38fd6a8859447a154a5698a3e21d9203262be2 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 22 Mar 2019 00:01:30 +0100 Subject: Parse a lot more of the import types --- dhall_core/src/import.rs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'dhall_core/src/import.rs') 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, + // pub headers: Option, +} + +#[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 -- cgit v1.2.3