update ch19-06 close #497

pull/498/head
KaiserY 4 years ago
parent 743ba2472d
commit fdf1ea90da

@ -4,11 +4,11 @@
> <br>
> commit 7ddc46460f09a5cd9bd2a620565bdc20b3315ea9
我们已经在本书中使用过像 `println!` 这样的宏了,不过还没完全探索什么是宏以及它是如何工作的。**宏***Macro*)指的是 Rust 中一系列的功能:**声明***Declarative*)宏,使用 `macro_rules!`,和三种 **过程***Procedural*)宏:
我们已经在本书中使用过像 `println!` 这样的宏了,不过还没完全探索什么是宏以及它是如何工作的。**宏***Macro*)指的是 Rust 中一系列的功能:使用 `macro_rules!`**声明***Declarative*)宏,和三种 **过程***Procedural*)宏:
* 自定义 `#[derive]` 宏在结构体和枚举上指定通过 `derive` 属性添加的代码
* 类属性Attribute-like宏定义可用于任意项的自定义属性
* 类函数宏看起来像函数不过作用于作为参数传递的 token
* 类函数宏看起来像函数不过作用于作为参数传递的 token
我们会依次讨论每一种宏,不过首要的是,为什么已经有了函数还需要宏呢?

Loading…
Cancel
Save