From a1f370cb68974c1e69f8f85345e91ec763b23ae2 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 18 Mar 2020 22:28:41 +0000 Subject: Expose simple::Val/Ty properly in the API --- dhall_proc_macros/src/derive.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'dhall_proc_macros/src') diff --git a/dhall_proc_macros/src/derive.rs b/dhall_proc_macros/src/derive.rs index 4885b49..f7edf3a 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::simple::Type::make_record_type( - vec![ #(#entries),* ].into_iter() - ) }) + Ok(quote! { + ::serde_dhall::simple::TyKind::Record( + vec![ #(#entries),* ].into_iter().collect() + ).into() + }) } fn derive_for_enum( @@ -89,9 +91,11 @@ fn derive_for_enum( }) .collect::>()?; - Ok(quote! { ::serde_dhall::simple::Type::make_union_type( - vec![ #(#entries),* ].into_iter() - ) }) + Ok(quote! { + ::serde_dhall::simple::TyKind::Union( + vec![ #(#entries),* ].into_iter().collect() + ).into() + }) } 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::simple::Type { + fn static_type() -> ::serde_dhall::simple::Type { #(#assertions)* #get_type } -- cgit v1.2.3