From 3d96020d63845c1ebd4eaab2514128d84e5bfe36 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 24 Jul 2021 12:10:05 +0100 Subject: [PATCH] config, wip macro Signed-off-by: Ian Jackson --- macros/macros.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/macros/macros.rs b/macros/macros.rs index a3741bf..1585a63 100644 --- a/macros/macros.rs +++ b/macros/macros.rs @@ -35,18 +35,19 @@ pub fn resolve(input: proc_macro::TokenStream) -> proc_macro::TokenStream { // let mut output = vec![]; for field in &fields.named { -// dbg!(field); + dbg!(field); let mut skl = quote!{ SKL::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(); if &attr.path == &parse_quote!{ limited } { - skl = quote!{ SKL::Limited }; - method = quote!{ limited }; + skl = quote_spanned!{atspan=> SKL::Limited }; + method = quote_spanned!{atspan=> limited }; } else if &attr.path == &parse_quote!{ server } { - method = quote!{ server }; + method = quote_spanned!{atspan=> server }; } else if &attr.path == &parse_quote!{ client } { - method = quote!{ client }; + method = quote_spanned!{atspan=> client }; } } else if &attr.path == &parse_quote!{ special } { let meta = match attr.parse_meta().unwrap() { -- 2.30.2