原书出处
Write Powerful Rust Macros
08 Builder with attributes 属性宏输入与参数解析
A more up-to-date alternative to our current approach is to use syn::meta ::parser. The implementation in listing 8.39 is quite similar to a documentation example. We parse_macro_input!(attr with attr_parser) to pass in a custom parser for the attributes, which we defined one line above using syn::meta::parser. Actual parsing is a task for our custom struct, which checks whether we have an exclude attribute in the path property, throwing an error if we receive something else.
Within the attribute, we dive one level
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/chapter-8.xhtml#p187
EPUB SHA-256:68c7ed23324b44144895c3bb55f55731454da237867b66ec66ca6404f5b93661