Skip to content

Commit 2bd33e5

Browse files
authored
Merge pull request #918 from arisliang/patch-3
Update ch15-03-drop.md
2 parents c68c8e5 + 615d1be commit 2bd33e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ch15-03-drop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- https://github.com/rust-lang/book/blob/main/src/ch15-03-drop.md -->
44
<!-- commit 56ec353290429e6547109e88afea4de027b0f1a9 -->
55

6-
对于智能指针模式来说第二个重要的 trait 是 `Drop`,其允许我们在值要离开作用域时自定义要执行的操作。可以为任何类型提供 `Drop` trait 的实现,同时所指定的代码被用于释放类似于文件或网络连接的资源。
6+
对于智能指针模式来说第二个重要的 trait 是 `Drop`,其允许我们在值要离开作用域时自定义要执行的操作。你可以为任何类型提供 `Drop` trait 的实现,同时所指定的代码被用于释放类似于文件或网络连接的资源。
77

88
我们在智能指针上下文中讨论 `Drop`,是因为在实现智能指针时几乎总会用到 `Drop` trait。例如,当 `Box<T>` 被丢弃时会释放 box 指向的堆空间。
99

0 commit comments

Comments
 (0)