From a88cdfa4a674c251cfdac21043ca1d87fa28824c Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 12 May 2019 20:05:30 +0200 Subject: Finish implementing binary encoding --- dhall/src/phase/binary.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'dhall/src/phase/binary.rs') 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), UnionMap(&'a DupTreeMap>), + 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), } } } -- cgit v1.2.3