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

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.

主站蜘蛛池模板: 沾益县| 牡丹江市| 饶河县| 额济纳旗| 江永县| 吴堡县| 萨迦县| 白朗县| 青铜峡市| 南通市| 河津市| 印江| 镇原县| 芒康县| 吐鲁番市| 盈江县| 彭州市| 略阳县| 渝中区| 江川县| 河东区| 富民县| 铅山县| 兴国县| 武安市| 龙川县| 舟山市| 嘉黎县| 延寿县| 岳阳县| 石景山区| 青川县| 玛纳斯县| 同江市| 钟祥市| 滕州市| 双桥区| 道真| 永修县| 成都市| 汉阴县|