官术网_书友最值得收藏!

After use

Whenever the list needs to be disposed of, Rust calls a drop() method that is automatically implemented. However, since this is an automated process, each member is dropped recursively—which works OK until the level of nested next pointers exceeds the stack for executing the drop() method and crashes the program with an unexpected stack overflow message.

As a consequence, it is a good idea for production usage to also implement the Drop trait and dispose of the list elements iteratively. By the way, a stack overflow also happens while using the derived Debug implementation to print a Node—for the same reason.

主站蜘蛛池模板: 布拖县| 获嘉县| 石景山区| 汽车| 八宿县| 封丘县| 新营市| 双流县| 松江区| 长兴县| 聂拉木县| 永善县| 乐至县| 樟树市| 新乐市| 韶山市| 城固县| 太和县| 蛟河市| 拉萨市| 咸丰县| 武安市| 新余市| 静宁县| 灯塔市| 青阳县| 长葛市| 偃师市| 商洛市| 金川县| 合阳县| 祥云县| 陵川县| 安阳县| 防城港市| 江口县| 乐都县| 青海省| 翁源县| 阳山县| 商水县|