From 6c023ddeaa0894813fc74038af7568c2d867c052 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 14 Jan 2023 11:36:57 +0100 Subject: parsing should work --- ebml_derive/src/lib.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'ebml_derive') diff --git a/ebml_derive/src/lib.rs b/ebml_derive/src/lib.rs index f3957df..fc8af7d 100644 --- a/ebml_derive/src/lib.rs +++ b/ebml_derive/src/lib.rs @@ -25,7 +25,9 @@ pub fn define_ebml(ts: TokenStream) -> TokenStream { syn::parse2::(match e.r#type.clone() { None => quote!((Master)), Some(r#type) => match r#type.as_str() { + "Int" => quote!((i64)), "Uint" => quote!((u64)), + "Float" => quote!((f64)), "Utf8" => quote!((String)), "Binary" => quote!((Vec)), _ => panic!("unsupported type {}", r#type), @@ -53,17 +55,9 @@ pub fn define_ebml(ts: TokenStream) -> TokenStream { let parse_match = tags .iter() - .map( - |Tag { - id, name, r#type, .. - }| { - if let Some(_) = r#type { - quote! { #id => Self::#name(crate::ValueFromBuf::from_buf(data)?) } - } else { - quote! { #id => Self::#name(Master::Start) } - } - }, - ) + .map(|Tag { id, name, .. }| { + quote! { #id => Self::#name(crate::ValueFromBuf::from_buf(data)?) } + }) .collect::>(); let master_match = tags .iter() -- cgit v1.2.3-70-g09d2