← 返回卡片

原书出处

Write Powerful Rust Macros

05 Hiding information and creating mini-DSLs with function-like macros 读取标识符并折叠调用

核验版本的摘录快照 · 导入于 2026-11-25T09:20:41.653Z

for_each. If total, which contains our output,

is empty, we are at our first element and should combine it with last_ident using compose_two, putting that entire TokenStream into total. This is why we popped the last element: so we would know when we need to combine the first two elements of the reversed vector. Once past this first composition, things become simpler: we keep taking the current element and putting it into a compose_two with the current total. The resulting TokenStream becomes

our new total (see figure 5.4). Finally,

此预览只包含定位所需的摘录和上下文。

原书定位详情

来源:a19c7933-4eda-4176-aebd-30fe7e1ad292

正文位置:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/chapter-5.xhtml#p86

EPUB SHA-256:68c7ed23324b44144895c3bb55f55731454da237867b66ec66ca6404f5b93661