From f1daab41ba05d3e2754321f89383e2c99ed430a7 Mon Sep 17 00:00:00 2001 From: Orefa Date: Mon, 30 Aug 2021 22:10:24 +0800 Subject: [PATCH] fix anchor --- src/ch19-03-advanced-traits.md | 13 +++++-------- src/ch19-05-advanced-functions-and-closures.md | 6 ++---- src/ch19-06-macros.md | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/ch19-03-advanced-traits.md b/src/ch19-03-advanced-traits.md index b272f2a..acee045 100644 --- a/src/ch19-03-advanced-traits.md +++ b/src/ch19-03-advanced-traits.md @@ -503,11 +503,8 @@ fn main() { 上面便是 newtype 模式如何与 trait 结合使用的;还有一个不涉及 trait 的实用模式。现在让我们将话题的焦点转移到一些与 Rust 类型系统交互的高级方法上来吧。 -[implementing-a-trait-on-a-type]: -ch10-02-traits.html#implementing-a-trait-on-a-type -[the-iterator-trait-and-the-next-method]: -ch13-02-iterators.html#the-iterator-trait-and-the-next-method -[traits-defining-shared-behavior]: -ch10-02-traits.html#traits-defining-shared-behavior -[smart-pointer-deref]: ch15-02-deref.html#treating-smart-pointers-like-regular-references-with-the-deref-trait -[tuple-structs]: ch05-01-defining-structs.html#using-tuple-structs-without-named-fields-to-create-different-types +[implementing-a-trait-on-a-type]: ch10-02-traits.html#为类型实现-trait +[the-iterator-trait-and-the-next-method]: ch13-02-iterators.html#iterator-trait-和-next-方法 +[traits-defining-shared-behavior]: ch10-02-traits.html#trait定义共享的行为 +[smart-pointer-deref]: ch15-02-deref.html#通过实现-deref-trait-将某类型像引用一样处理 +[tuple-structs]: ch05-01-defining-structs.html#使用没有命名字段的元组结构体来创建不同的类型 diff --git a/src/ch19-05-advanced-functions-and-closures.md b/src/ch19-05-advanced-functions-and-closures.md index 41a56f7..ea00669 100644 --- a/src/ch19-05-advanced-functions-and-closures.md +++ b/src/ch19-05-advanced-functions-and-closures.md @@ -116,7 +116,5 @@ fn returns_closure() -> Box i32> { 接下来让我们学习宏! -[advanced-traits]: -ch19-03-advanced-traits.html#advanced-traits -[using-trait-objects-that-allow-for-values-of-different-types]: -ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types +[advanced-traits]: ch19-03-advanced-traits.html#高级-trait +[using-trait-objects-that-allow-for-values-of-different-types]: ch17-02-trait-objects.html#为使用不同类型的值而设计的-trait-对象 diff --git a/src/ch19-06-macros.md b/src/ch19-06-macros.md index 9f9b7ff..bd052ee 100644 --- a/src/ch19-06-macros.md +++ b/src/ch19-06-macros.md @@ -341,7 +341,7 @@ pub fn route(attr: TokenStream, item: TokenStream) -> TokenStream { 类函数宏定义看起来像函数调用的宏。类似于 `macro_rules!`,它们比函数更灵活;例如,可以接受未知数量的参数。然而 `macro_rules!` 宏只能使用之前 [“使用 `macro_rules!` 的声明宏用于通用元编程”][decl] 介绍的类匹配的语法定义。类函数宏获取 `TokenStream` 参数,其定义使用 Rust 代码操纵 `TokenStream`,就像另两种过程宏一样。一个类函数宏例子是可以像这样被调用的 `sql!` 宏: -[decl]: #declarative-macros-with-macro_rules-for-general-metaprogramming +[decl]: #使用-macro_rules-的声明宏用于通用元编程 ```rust,ignore let sql = sql!(SELECT * FROM posts WHERE id=1);