原书出处
Write Powerful Rust Macros
08 Builder with attributes 默认值配置与生成闭包
As you can see, attributes are present both at the root level of DeriveInput and at the field level. Previously, we were adding attributes to individual fields. This time we placed one on top of our struct. So we should look in the root. Our use_defaults helper is simple. It checks whether any attribute identifier matches the name builder_defaults. The result is given to original_struct_setters, the only method that needs to know about it.
Meanwhile, in fields.rs, we have more work
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/chapter-8.xhtml#p71
EPUB SHA-256:68c7ed23324b44144895c3bb55f55731454da237867b66ec66ca6404f5b93661