Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

小结与选型

核心要点

概念一句话
何时展开编译 sui move build
如何定义macro fun$ 参数, name!(...) 调用
fun 区别实参为片段代入,不是先求值再传
Lambda仅宏参数可用 |...| -> R
标准库vector / option 宏优先于手写循环

选型建议

  1. 遍历、折叠、重复 n 次:优先 vector 宏与 u8::do! 等。
  2. 处理 Option 分支:优先 option::do! / destroy_or!
  3. 断言assert! + #[error] 常量(Move 2024 可读错误)。
  4. 自定义重复模式:考虑 macro fun,但保持宏体简短、可读。

与本书其它章的衔接

按全书侧边栏顺序,第八章第九~十章在本章之前;第十二章(Framework 等)起在本章之后。