summaryrefslogtreecommitdiff
path: root/serde_dhall/src/serialize.rs
diff options
context:
space:
mode:
authorNadrieril2020-10-28 21:45:42 +0000
committerNadrieril2020-10-28 22:52:41 +0000
commit3b728aff86a086f71f013b77a715c33748d9f6a8 (patch)
tree7c1ceba27495481b766b4ea84601d7381530f5c2 /serde_dhall/src/serialize.rs
parente070270c3f1f10d46281ed7751ff95e15092e7f4 (diff)
Make type annotation optional to allow serializing SimpleValue
Diffstat (limited to '')
-rw-r--r--serde_dhall/src/serialize.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/serde_dhall/src/serialize.rs b/serde_dhall/src/serialize.rs
index dd3e426..21b1931 100644
--- a/serde_dhall/src/serialize.rs
+++ b/serde_dhall/src/serialize.rs
@@ -11,7 +11,7 @@ pub trait Sealed {}
pub trait ToDhall: Sealed {
#[doc(hidden)]
- fn to_dhall(&self, ty: &SimpleType) -> Result<Value>;
+ fn to_dhall(&self, ty: Option<&SimpleType>) -> Result<Value>;
}
impl<T> Sealed for T where T: ser::Serialize {}
@@ -20,7 +20,7 @@ impl<T> ToDhall for T
where
T: ser::Serialize,
{
- fn to_dhall(&self, ty: &SimpleType) -> Result<Value> {
+ fn to_dhall(&self, ty: Option<&SimpleType>) -> Result<Value> {
let sval: SimpleValue = self.serialize(Serializer)?;
sval.into_value(ty)
}
@@ -310,3 +310,15 @@ impl ser::SerializeStruct for StructSerializer {
Ok(Record(self.0))
}
}
+
+impl serde::ser::Serialize for SimpleValue {
+ fn serialize<S>(
+ &self,
+ serializer: S,
+ ) -> std::result::Result<S::Ok, S::Error>
+ where
+ S: serde::ser::Serializer,
+ {
+ todo!()
+ }
+}