};
let target = &input.ident;
- let names = fields.named.iter().map(
- |f| Literal::string( &f.ident.as_ref().unwrap().to_string() )
- )
- .collect_vec();
+ let mut names = vec![];
let mut output = vec![];
for field in &fields.named {
dbg!(field);
- let mut skl = quote!{ SKL::Ordinary };
+ let mut skl = quote!{ SectionKindList::Ordinary };
let mut method = quote!{ ordinary };
for attr in &field.attrs {
if attr.tokens.is_empty() {
let atspan = attr.path.segments.last().unwrap().ident.span();
method = attr.path.to_token_stream();
if &attr.path == &parse_quote!{ limited } {
- skl = quote_spanned!{atspan=> SKL::Limited };
+ skl = quote_spanned!{atspan=> SectionKindList::Limited };
}
} else if &attr.path == &parse_quote!{ special } {
let meta = match attr.parse_meta().unwrap() {
let fname_string = fname.as_ref().unwrap().to_string();
let fname_lit = Literal::string( &fname_string );
+ names.push(quote!{
+ (#fname_lit, #skl),
+ });
output.push(quote!{
#fname: rctx. #method ( #fname_lit )?,
});
let output = quote! {
impl #target {
- const FIELDS: &'static [&'static str] = &[ #( #names ),* ];
+ const FIELDS: &'static [(&'static str, SectionKindList)]
+ = &[ #( #names ),* ];
fn resolve_instance(rctx: &ResolveContext)
-> ::std::result::Result<#target, anyhow::Error>