specctra_derive: fix mistaken declarations of macro attributes

This commit is contained in:
Tomasz Cichoń 2024-09-28 23:59:15 +02:00
parent 479791ea02
commit d86ef12e83
1 changed files with 7 additions and 3 deletions

View File

@ -4,13 +4,13 @@ use syn::{Attribute, DeriveInput, LitStr};
mod read;
mod write;
#[proc_macro_derive(ReadDsn, attributes(opt, anon, vec, anon_vec))]
#[proc_macro_derive(ReadDsn, attributes(anon, vec, anon_vec))]
pub fn derive_read(input: TokenStream) -> TokenStream {
let input = syn::parse_macro_input!(input as DeriveInput);
read::impl_read(&input).into()
}
#[proc_macro_derive(WriteSes, attributes(anon))]
#[proc_macro_derive(WriteSes, attributes(anon, vec, anon_vec))]
pub fn derive_write(input: TokenStream) -> TokenStream {
let input = syn::parse_macro_input!(input as DeriveInput);
write::impl_write(&input).into()
@ -27,5 +27,9 @@ fn attr_content(attrs: &Vec<Attribute>, name: &str) -> Option<String> {
attrs
.iter()
.find(|attr| attr.path().is_ident(name))
.and_then(|attr| Some(attr.parse_args::<LitStr>().expect("string literal").value()))
.and_then(|attr| Some(attr
.parse_args::<LitStr>()
.expect("string literal")
.value()
))
}