diff --git a/course-book/contents/SUMMARY.md b/course-book/contents/SUMMARY.md index 4dda6169..47a6fca9 100644 --- a/course-book/contents/SUMMARY.md +++ b/course-book/contents/SUMMARY.md @@ -64,14 +64,14 @@ - [注释和文档](advance/comment.md) - [深入类型之newtype和Sized](advance/custom-type.md) - [格式化输出](advance/formatted-output.md) - - [智能指针 doing](advance/smart-pointer/intro.md) + - [智能指针](advance/smart-pointer/intro.md) - [Box堆对象分配](advance/smart-pointer/box.md) - [Deref解引用](advance/smart-pointer/deref.md) - [Drop释放资源](advance/smart-pointer/drop.md) - [Rc与Arc实现1vN所有权机制](advance/smart-pointer/rc-arc.md) - [Cell与RefCell内部可变性](advance/smart-pointer/cell-refcell.md) - - [Weak与循环引用](advance/smart-pointer/circle-referrence.md) - - [自引用](advance/smart-pointer/self-referrence.md) + - [Weak与循环引用](advance/smart-pointer/circle-reference.md) + - [结构体中的自引用](advance/self-referential.md)) - [全局变量 todo](advance/global-variable.md) - [多线程 todo](advance/multi-threads/intro.md) - [线程管理 todo](advance/multi-threads/thread.md) diff --git a/course-book/contents/advance/smart-pointer/self-referrence.md b/course-book/contents/advance/self-referential.md similarity index 83% rename from course-book/contents/advance/smart-pointer/self-referrence.md rename to course-book/contents/advance/self-referential.md index a5994366..f08145f4 100644 --- a/course-book/contents/advance/smart-pointer/self-referrence.md +++ b/course-book/contents/advance/self-referential.md @@ -1,5 +1,7 @@ -## 自引用 -本文分为上下两篇,试图彻底解决困扰大家已久的循环引用和自引用问题,因此难度较高,但是非常值得深入阅读,它会让你对Rust的理解上升到一个新的境界。 +## 结构体自引用 +结构体自引用在Rust中是一个众所周知的难题,而且众说纷纭,也没有一篇文章能把相关的话题讲透,那本文就王婆卖瓜,来试试看能不能讲透这一块儿内容,让读者大大们舒心。 + +> 这章内容足足花了半个月的时间来准备! - 来自作者的诉苦 ## 使用Pin来解决自引用 Pin在后续章节会深入讲解,目前你只需要知道它可以固定住一个值,防止该值的所有权被转移。通过Pin也可以实现自引用的数据结构: @@ -66,6 +68,4 @@ fn main() { ## 总结 -本文深入讲解了何为引用循环以及如何使用Weak来解决,同时还结合`Rc`、`RefCell`、`Weak`等实现了两个有实战价值的例子,让大家对智能指针的使用更加融会贯通。 - -至此,智能指针一章即将结束(严格来说还有一个Mutex放在多线程一章讲解),而Rust语言本身的学习之旅也即将结束,后面我们将深入多线程、项目工程、应用实践、性能分析等特色专题,来一睹Rust在这些领域的风采。 \ No newline at end of file +本文深入讲解了何为引用循环以及如何使用Weak来解决,同时还结合`Rc`、`RefCell`、`Weak`等实现了两个有实战价值的例子,让大家对智能指针的使用更加融会贯通。 \ No newline at end of file diff --git a/course-book/contents/advance/smart-pointer/circle-referrence.md b/course-book/contents/advance/smart-pointer/circle-reference.md similarity index 97% rename from course-book/contents/advance/smart-pointer/circle-referrence.md rename to course-book/contents/advance/smart-pointer/circle-reference.md index f047f423..e4f8612b 100644 --- a/course-book/contents/advance/smart-pointer/circle-referrence.md +++ b/course-book/contents/advance/smart-pointer/circle-reference.md @@ -291,3 +291,5 @@ fn main() { ## 总结 本文深入讲解了何为循环引用以及如何使用`Weak`来解决,同时还结合`Rc`、`RefCell`、`Weak`等实现了两个有实战价值的例子,让大家对智能指针的使用更加融会贯通。 + +至此,智能指针一章即将结束(严格来说还有一个Mutex放在多线程一章讲解),而Rust语言本身的学习之旅也即将结束,后面我们将深入多线程、项目工程、应用实践、性能分析等特色专题,来一睹Rust在这些领域的风采。 \ No newline at end of file