diff options
author | metamuffin <metamuffin@disroot.org> | 2023-01-14 11:36:57 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-01-14 11:36:57 +0100 |
commit | 6c023ddeaa0894813fc74038af7568c2d867c052 (patch) | |
tree | 3d323c62fa8a6c2a7827d15061843fce8a7418f0 /ebml_derive/src | |
parent | 855a8896175ee45a3376775203fa20e629d809b3 (diff) | |
download | jellything-6c023ddeaa0894813fc74038af7568c2d867c052.tar jellything-6c023ddeaa0894813fc74038af7568c2d867c052.tar.bz2 jellything-6c023ddeaa0894813fc74038af7568c2d867c052.tar.zst |
parsing should work
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() |