summaryrefslogtreecommitdiff
path: root/dhall/src
diff options
context:
space:
mode:
authorNadrieril2019-05-12 20:05:30 +0200
committerNadrieril2019-05-12 20:05:30 +0200
commita88cdfa4a674c251cfdac21043ca1d87fa28824c (patch)
treed0bd20993cbe6158e8b7ee2f1963adaab824fe5c /dhall/src
parentaac3a50ec2e7fd31e4264e3c87b9500ad6dc9beb (diff)
Finish implementing binary encoding
Diffstat (limited to 'dhall/src')
-rw-r--r--dhall/src/phase/binary.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs
index a3ab5de..96eaa6c 100644
--- a/dhall/src/phase/binary.rs
+++ b/dhall/src/phase/binary.rs
@@ -380,6 +380,7 @@ enum Serialize<'a> {
CBOR(cbor::Value),
RecordMap(&'a DupTreeMap<Label, ParsedSubExpr>),
UnionMap(&'a DupTreeMap<Label, Option<ParsedSubExpr>>),
+ Import(&'a Import),
}
macro_rules! count {
@@ -564,12 +565,12 @@ where
ImportLocation::Remote(url) => {
match &url.headers {
None => ser_seq.serialize_element(&Null)?,
- Some(_x) => unimplemented!(),
- // match cbor_value_to_dhall(&x)?.as_ref() {
- // Embed(import) => Some(Box::new(
- // import.location_hashed.clone(),
- // )),
- // }
+ Some(location_hashed) => ser_seq.serialize_element(
+ &self::Serialize::Import(&Import {
+ mode: ImportMode::Code,
+ location_hashed: location_hashed.as_ref().clone(),
+ }),
+ )?,
};
ser_seq.serialize_element(&url.authority)?;
for p in &url.path {
@@ -616,6 +617,7 @@ impl<'a> serde::ser::Serialize for Serialize<'a> {
(cbor::Value::String(k.into()), v)
}))
}
+ Serialize::Import(import) => serialize_import(ser, import),
}
}
}