全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Recursive type, box?

又称: recursive type · box (Rust)

Definition 7.9 University Computer Science — Year 2 · 第 7 章 — Enums, Pattern Matching and Error Handling

A recursive type has a variant or a field whose type contains the type itself. Its values must be finite, and its size must be known: the recursive field is therefore a box, Box<T>, a pointer to a value of type T on the heap that owns it and frees it when dropped.

The tree of , built by inserting 189, 65, 251, 133, 412, 98 and 320. Each arrow is a Box: the node owns its children, and dropping the root frees the whole tree. The leaves under 98 and 320 are not drawn.
The tree of Output 7.8, built by inserting 189, 65, 251, 133, 412, 98 and 320. Each arrow is a Box: the node owns its children, and dropping the root frees the whole tree. The leaves under 98 and 320 are not drawn.
在原文中阅读 →