| 12 | |
| 13 | impl Parse for AttributeArgs { |
| 14 | fn parse(input: ParseStream) -> Result<Self> { |
| 15 | if input.is_empty() { |
| 16 | return Ok(Self { |
| 17 | descriptor_link_section: None, |
| 18 | }); |
| 19 | } |
| 20 | |
| 21 | let arg_name: Ident = input.parse()?; |
| 22 | if arg_name != "descriptor_link_section" { |
| 23 | return Err(Error::new( |
| 24 | arg_name.span(), |
| 25 | "expected `descriptor_link_section`", |
| 26 | )); |
| 27 | } |
| 28 | input.parse::<Token![=]>()?; |
| 29 | let descriptor_link_section: LitStr = input.parse()?; |
| 30 | |
| 31 | Ok(Self { |
| 32 | descriptor_link_section: Some(descriptor_link_section.value()), |
| 33 | }) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | #[proc_macro_attribute] |