summaryrefslogtreecommitdiff
path: root/dhall_proc_macros
diff options
context:
space:
mode:
authorNadrieril2020-04-05 17:57:07 +0100
committerGitHub2020-04-05 17:57:07 +0100
commit7e977f282fb6a0eff0ef45738b9b5c98dc4c6fee (patch)
treead4249609707fd8720a44469152105c2f6a67c79 /dhall_proc_macros
parent5a5aa49e64197899006751db72e404f4b2292d4e (diff)
parent820214615547101f8f2b5de209b5189968bddfee (diff)
Merge pull request #154 from Nadrieril/cleanup-api
Rewrite serde_dhall API
Diffstat (limited to 'dhall_proc_macros')
-rw-r--r--dhall_proc_macros/Cargo.toml3
-rw-r--r--dhall_proc_macros/src/derive.rs19
-rw-r--r--dhall_proc_macros/tests/version_numbers.rs4
3 files changed, 18 insertions, 8 deletions
diff --git a/dhall_proc_macros/Cargo.toml b/dhall_proc_macros/Cargo.toml
index 6de2850..48b55e8 100644
--- a/dhall_proc_macros/Cargo.toml
+++ b/dhall_proc_macros/Cargo.toml
@@ -17,3 +17,6 @@ itertools = "0.9.0"
quote = "1.0"
proc-macro2 = "1.0"
syn = "1.0"
+
+[dev-dependencies]
+version-sync = "0.8"
diff --git a/dhall_proc_macros/src/derive.rs b/dhall_proc_macros/src/derive.rs
index 48626a0..e484ec6 100644
--- a/dhall_proc_macros/src/derive.rs
+++ b/dhall_proc_macros/src/derive.rs
@@ -52,9 +52,11 @@ fn derive_for_struct(
let ty = static_type(ty);
quote!( (#name.to_owned(), #ty) )
});
- Ok(quote! { ::serde_dhall::value::Value::make_record_type(
- vec![ #(#entries),* ].into_iter()
- ) })
+ Ok(quote! {
+ ::serde_dhall::SimpleType::Record(
+ vec![ #(#entries),* ].into_iter().collect()
+ )
+ })
}
fn derive_for_enum(
@@ -89,9 +91,11 @@ fn derive_for_enum(
})
.collect::<Result<_, Error>>()?;
- Ok(quote! { ::serde_dhall::value::Value::make_union_type(
- vec![ #(#entries),* ].into_iter()
- ) })
+ Ok(quote! {
+ ::serde_dhall::SimpleType::Union(
+ vec![ #(#entries),* ].into_iter().collect()
+ )
+ })
}
pub fn derive_static_type_inner(
@@ -164,8 +168,7 @@ pub fn derive_static_type_inner(
impl #impl_generics ::serde_dhall::StaticType
for #ident #ty_generics
#where_clause {
- fn static_type() ->
- ::serde_dhall::value::Value {
+ fn static_type() -> ::serde_dhall::SimpleType {
#(#assertions)*
#get_type
}
diff --git a/dhall_proc_macros/tests/version_numbers.rs b/dhall_proc_macros/tests/version_numbers.rs
new file mode 100644
index 0000000..9f1d04a
--- /dev/null
+++ b/dhall_proc_macros/tests/version_numbers.rs
@@ -0,0 +1,4 @@
+#[test]
+fn test_html_root_url() {
+ version_sync::assert_html_root_url_updated!("src/lib.rs");
+}