mirror of https://codeberg.org/topola/topola.git
specctra_derive: fix mistaken declarations of macro attributes
This commit is contained in:
parent
479791ea02
commit
d86ef12e83
|
|
@ -4,13 +4,13 @@ use syn::{Attribute, DeriveInput, LitStr};
|
||||||
mod read;
|
mod read;
|
||||||
mod write;
|
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 {
|
pub fn derive_read(input: TokenStream) -> TokenStream {
|
||||||
let input = syn::parse_macro_input!(input as DeriveInput);
|
let input = syn::parse_macro_input!(input as DeriveInput);
|
||||||
read::impl_read(&input).into()
|
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 {
|
pub fn derive_write(input: TokenStream) -> TokenStream {
|
||||||
let input = syn::parse_macro_input!(input as DeriveInput);
|
let input = syn::parse_macro_input!(input as DeriveInput);
|
||||||
write::impl_write(&input).into()
|
write::impl_write(&input).into()
|
||||||
|
|
@ -27,5 +27,9 @@ fn attr_content(attrs: &Vec<Attribute>, name: &str) -> Option<String> {
|
||||||
attrs
|
attrs
|
||||||
.iter()
|
.iter()
|
||||||
.find(|attr| attr.path().is_ident(name))
|
.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()
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue