diff options
Diffstat (limited to 'ebml_derive/src')
-rw-r--r-- | ebml_derive/src/lib.rs | 16 |
1 files changed, 5 insertions, 11 deletions
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::<FieldsUnnamed>(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<u8>)), _ => 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::<Vec<_>>(); let master_match = tags .iter() |