原书出处
Write Powerful Rust Macros
07 From panic to result: Error handling 替换特定位置的panic
Next, we search for macro statements inside the conditional (Stmt::Macro). At that point, the helper, extract_panic_content, which we will discuss momentarily, can be used to give back an option with the panic’s message—or none if the macro was not a panic. Once we have the message, we use it to replace the panic with an Err containing the original message.
As before, we use parse to get
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/chapter-7.xhtml#p109
EPUB SHA-256:68c7ed23324b44144895c3bb55f55731454da237867b66ec66ca6404f5b93661