From 3569f2578a01fc9d9fb05e7e7ac673996a3ac963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9C=96?= Date: Thu, 10 Feb 2022 23:36:38 +0800 Subject: [PATCH] =?UTF-8?q?Deref=E7=A4=BA=E4=BE=8B=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E6=98=AF*=20=E8=80=8C=E4=B8=8D=E6=98=AF&?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- book/contents/advance/smart-pointer/intro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/contents/advance/smart-pointer/intro.md b/book/contents/advance/smart-pointer/intro.md index 3b4b1769..e82394e2 100644 --- a/book/contents/advance/smart-pointer/intro.md +++ b/book/contents/advance/smart-pointer/intro.md @@ -14,7 +14,7 @@ Rust 标准库中定义的那些智能指针,虽重但强,可以提供比引 智能指针往往是基于结构体实现,它与我们自定义的结构体最大的区别在于它实现了 `Deref` 和 `Drop` 特征: -- `Deref` 可以让智能指针像引用那样工作,这样你就就可以写出同时支持智能指针和引用的代码,例如 `&T` +- `Deref` 可以让智能指针像引用那样工作,这样你就就可以写出同时支持智能指针和引用的代码,例如 `*T` - `Drop` 允许你指定智能指针超出作用域后自动执行的代码,例如做一些数据清除等收尾工作 智能指针在 Rust 中很常见,我们在本章不会全部讲解,而是挑选几个最常用、最有代表性的进行讲解: