mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
doc: Boxes diagram shows enum value inside box.
This commit is contained in:
parent
bf2ab22cd0
commit
065f936bf1
@ -1020,10 +1020,10 @@ being destroyed along with the owner. Since the `list` variable above is
|
|||||||
immutable, the whole list is immutable. The memory allocation itself is the
|
immutable, the whole list is immutable. The memory allocation itself is the
|
||||||
box, while the owner holds onto a pointer to it:
|
box, while the owner holds onto a pointer to it:
|
||||||
|
|
||||||
Cons cell Cons cell Cons cell
|
List box List box List box List box
|
||||||
+-----------+ +-----+-----+ +-----+-----+
|
+--------------+ +--------------+ +--------------+ +--------------+
|
||||||
| 1 | ~ | -> | 2 | ~ | -> | 3 | ~ | -> Nil
|
list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil |
|
||||||
+-----------+ +-----+-----+ +-----+-----+
|
+--------------+ +--------------+ +--------------+ +--------------+
|
||||||
|
|
||||||
An owned box is a common example of a type with a destructor. The allocated
|
An owned box is a common example of a type with a destructor. The allocated
|
||||||
memory is cleaned up when the box is destroyed.
|
memory is cleaned up when the box is destroyed.
|
||||||
|
Loading…
Reference in New Issue
Block a user