原书出处
Write Powerful Rust Macros
07 From panic to result: Error handling 将错误落到具体输入跨度
Our signature_output_as_result now returns an Err if the signature contains a Result. Inside that, Err is a value of type syn::Error. The constructor of that error type requires us to pass back a span and a message (which should implement Display). We’ve encountered span before and noted how it points back to the original code. That might finally be useful! One idea is to pass the span of sig, allowing Rust to point to the signature.
In the message, we give some information
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/chapter-7.xhtml#p140
EPUB SHA-256:68c7ed23324b44144895c3bb55f55731454da237867b66ec66ca6404f5b93661