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

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.

主站蜘蛛池模板: 亳州市| 武功县| 姜堰市| 县级市| 洛扎县| 凉山| 洱源县| 阿荣旗| 黄大仙区| 新建县| 科技| 清涧县| 蒙阴县| 潜山县| 张家川| 罗江县| 新宾| 新乡县| 方正县| 灵川县| 翁源县| 北票市| 二连浩特市| 郁南县| 枣强县| 都江堰市| 苍南县| 天柱县| 全椒县| 邵武市| 娱乐| 韶山市| 云南省| 明星| 商洛市| 明星| 陈巴尔虎旗| 龙里县| 富顺县| 哈密市| 彭山县|