From b148f7ffa5c7c65dcf3df43bb45e636ba42bf041 Mon Sep 17 00:00:00 2001 From: YangQi <70502828+YangFong@users.noreply.github.com> Date: Tue, 11 Jan 2022 11:26:55 +0800 Subject: [PATCH] fix: Supplementary jump link --- ...07-04-bringing-paths-into-scope-with-the-use-keyword.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md b/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md index 745f3fe..4b7b4d7 100644 --- a/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md +++ b/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md @@ -186,7 +186,7 @@ rand = "0.5.5" 在 *Cargo.toml* 中加入 `rand` 依赖告诉了 Cargo 要从 [crates.io](https://crates.io) 下载 `rand` 和其依赖,并使其可在项目代码中使用。 -接着,为了将 `rand` 定义引入项目包的作用域,我们加入一行 `use` 起始的包名,它以 `rand` 包名开头并列出了需要引入作用域的项。回忆一下第二章的 “生成一个随机数” 部分,我们曾将 `Rng` trait 引入作用域并调用了 `rand::thread_rng` 函数: +接着,为了将 `rand` 定义引入项目包的作用域,我们加入一行 `use` 起始的包名,它以 `rand` 包名开头并列出了需要引入作用域的项。回忆一下第二章的 [“生成一个随机数”][rand] 部分,我们曾将 `Rng` trait 引入作用域并调用了 `rand::thread_rng` 函数: ```rust,ignore use rand::Rng; @@ -264,4 +264,7 @@ use std::collections::*; 这个 `use` 语句将 `std::collections` 中定义的所有公有项引入当前作用域。使用 glob 运算符时请多加小心!Glob 会使得我们难以推导作用域中有什么名称和它们是在何处定义的。 -glob 运算符经常用于测试模块 `tests` 中,这时会将所有内容引入作用域;我们将在第十一章 “如何编写测试” 部分讲解。glob 运算符有时也用于 prelude 模式;查看 [标准库中的文档](https://doc.rust-lang.org/std/prelude/index.html#other-preludes) 了解这个模式的更多细节。 +glob 运算符经常用于测试模块 `tests` 中,这时会将所有内容引入作用域;我们将在第十一章 [“如何编写测试”][writing-tests] 部分讲解。glob 运算符有时也用于 prelude 模式;查看 [标准库中的文档](https://doc.rust-lang.org/std/prelude/index.html#other-preludes) 了解这个模式的更多细节。 + +[rand]: ch02-00-guessing-game-tutorial.html#生成一个随机数 +[writing-tests]: ch11-01-writing-tests.html#如何编写测试 \ No newline at end of file