Merge pull request #758 from huacnlee/update-autocorrect

Upgrade AutoCorrect v2.9.0 and fix docs.
pull/759/head
KaiserY 9 months ago committed by GitHub
commit 0a72077d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,4 +11,4 @@ jobs:
fetch-depth: 1
- name: Lint
uses: huacnlee/autocorrect-action@v2.5.8
uses: huacnlee/autocorrect-action@v2.9.0

@ -88,9 +88,9 @@
- [Cargo 自定义扩展命令](ch14-05-extending-cargo.md)
- [智能指针](ch15-00-smart-pointers.md)
- [使用`Box<T>` 指向堆上数据](ch15-01-box.md)
- [使用`Deref` Trait 将智能指针当作常规引用处理](ch15-02-deref.md)
- [使用`Drop` Trait 运行清理代码](ch15-03-drop.md)
- [使用 `Box<T>` 指向堆上数据](ch15-01-box.md)
- [使用 `Deref` Trait 将智能指针当作常规引用处理](ch15-02-deref.md)
- [使用 `Drop` Trait 运行清理代码](ch15-03-drop.md)
- [`Rc<T>` 引用计数智能指针](ch15-04-rc.md)
- [`RefCell<T>` 与内部可变性模式](ch15-05-interior-mutability.md)
- [引用循环会导致内存泄漏](ch15-06-reference-cycles.md)
@ -99,7 +99,7 @@
- [使用线程同时地运行代码](ch16-01-threads.md)
- [使用消息传递在线程间通信](ch16-02-message-passing.md)
- [共享状态并发](ch16-03-shared-state.md)
- [使用`Sync` 与 `Send` Traits 的可扩展并发:](ch16-04-extensible-concurrency-sync-and-send.md)
- [使用 `Sync` 与 `Send` Traits 的可扩展并发:](ch16-04-extensible-concurrency-sync-and-send.md)
- [Rust 的面向对象编程特性](ch17-00-oop.md)
- [面向对象语言的特点](ch17-01-what-is-oo.md)

@ -88,9 +88,9 @@
- [Cargo 自定义扩展命令](ch14-05-extending-cargo.md)
- [智能指针](ch15-00-smart-pointers.md)
- [使用`Box<T>` 指向堆上数据](ch15-01-box.md)
- [使用`Deref` Trait 将智能指针当作常规引用处理](ch15-02-deref.md)
- [使用`Drop` Trait 运行清理代码](ch15-03-drop.md)
- [使用 `Box<T>` 指向堆上数据](ch15-01-box.md)
- [使用 `Deref` Trait 将智能指针当作常规引用处理](ch15-02-deref.md)
- [使用 `Drop` Trait 运行清理代码](ch15-03-drop.md)
- [`Rc<T>` 引用计数智能指针](ch15-04-rc.md)
- [`RefCell<T>` 与内部可变性模式](ch15-05-interior-mutability.md)
- [引用循环会导致内存泄漏](ch15-06-reference-cycles.md)
@ -99,7 +99,7 @@
- [使用线程同时地运行代码](ch16-01-threads.md)
- [使用消息传递在线程间通信](ch16-02-message-passing.md)
- [共享状态并发](ch16-03-shared-state.md)
- [使用`Sync` 与 `Send` Traits 的可扩展并发](ch16-04-extensible-concurrency-sync-and-send.md)
- [使用 `Sync` 与 `Send` Traits 的可扩展并发](ch16-04-extensible-concurrency-sync-and-send.md)
- [Rust 的面向对象编程特性](ch17-00-oop.md)
- [面向对象语言的特点](ch17-01-what-is-oo.md)

@ -15,7 +15,7 @@
回到示例 7-1假设我们希望调用 `add_to_waitlist` 函数。还是同样的问题,`add_to_waitlist` 函数的路径是什么?在示例 7-3 中删除了一些模块和函数。
我们在 crate 根定义了一个新函数 `eat_at_restaurant`,并在其中展示调用 `add_to_waitlist` 函数的两种方法。`eat_at_restaurant` 函数是我们 crate 库的一个公共 API所以我们使用 `pub` 关键字来标记它。在 [“使用`pub`关键字暴露路径”][pub] 一节,我们将详细介绍 `pub`。注意,这个例子无法编译通过,我们稍后会解释原因。
我们在 crate 根定义了一个新函数 `eat_at_restaurant`,并在其中展示调用 `add_to_waitlist` 函数的两种方法。`eat_at_restaurant` 函数是我们 crate 库的一个公共 API所以我们使用 `pub` 关键字来标记它。在 [“使用 `pub` 关键字暴露路径”][pub] 一节,我们将详细介绍 `pub`。注意,这个例子无法编译通过,我们稍后会解释原因。
<span class="filename">文件名src/lib.rs</span>

@ -40,7 +40,7 @@
{{#rustdoc_include ../listings/ch17-oop/listing-17-02/src/lib.rs:here}}
```
<span class="caption">示例 17-2: 在`AveragedCollection` 结构体上实现了`add`、`remove` 和 `average` 公有方法</span>
<span class="caption">示例 17-2: 在 `AveragedCollection` 结构体上实现了 `add`、`remove` 和 `average` 公有方法</span>
公有方法 `add`、`remove` 和 `average` 是修改 `AveragedCollection` 实例的唯一方式。当使用 `add` 方法把一个元素加入到 `list` 或者使用 `remove` 方法来删除时,这些方法的实现同时会调用私有的 `update_average` 方法来更新 `average` 字段。

@ -133,7 +133,7 @@
{{#rustdoc_include ../listings/ch17-oop/listing-17-17/src/lib.rs:here}}
```
<span class="caption">示例 17-17: 更新 `Post``content` 方法来委托调用 `State` 的`content` 方法</span>
<span class="caption">示例 17-17: 更新 `Post``content` 方法来委托调用 `State` `content` 方法</span>
因为目标是将所有像这样的规则保持在实现了 `State` 的结构体中,我们将调用 `state` 中的值的 `content` 方法并传递博文实例(也就是 `self`)作为参数。接着返回 `state` 值的 `content` 方法的返回值。

Loading…
Cancel
Save