- let len = &tail_str[..tail_str.len() - 1];
- Some(syn::Type::Array(syn::TypeArray {
- bracket_token: syn::token::Bracket { span: Span::call_site() },
- elem: Box::new(syn::Type::Path(syn::TypePath {
- qself: None,
- path: syn::Path::from(syn::PathSegment::from(syn::Ident::new("u8", Span::call_site()))),
- })),
- semi_token: syn::Token!(;)(Span::call_site()),
- len: syn::Expr::Lit(syn::ExprLit { attrs: Vec::new(), lit: syn::Lit::Int(syn::LitInt::new(len, Span::call_site())) }),
- }))
+ let len = usize::from_str_radix(&tail_str[..tail_str.len() - 1], 10).unwrap();
+ Some(parse_quote!([u8; #len]))