aboutsummaryrefslogtreecommitdiff
path: root/macros/src/injectable/named_attr_input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src/injectable/named_attr_input.rs')
-rw-r--r--macros/src/injectable/named_attr_input.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/macros/src/injectable/named_attr_input.rs b/macros/src/injectable/named_attr_input.rs
index 5f7123c..eaa9dbf 100644
--- a/macros/src/injectable/named_attr_input.rs
+++ b/macros/src/injectable/named_attr_input.rs
@@ -1,8 +1,11 @@
+use quote::ToTokens;
use syn::parse::Parse;
+use syn::token::Paren;
use syn::{parenthesized, LitStr};
pub struct NamedAttrInput
{
+ pub paren: Paren,
pub name: LitStr,
}
@@ -12,10 +15,22 @@ impl Parse for NamedAttrInput
{
let content;
- parenthesized!(content in input);
+ let paren = parenthesized!(content in input);
Ok(Self {
+ paren,
name: content.parse()?,
})
}
}
+
+impl ToTokens for NamedAttrInput
+{
+ fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream)
+ {
+ self.paren
+ .surround(&mut self.name.to_token_stream(), |stream| {
+ stream.to_tokens(tokens);
+ });
+ }
+}