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

Code review

The preceding code is somewhat different from the code in previous examples where we have simply used to_owned() to convert the slice to a string. We now have to create a mutable string and assign to that rather than just add to the end of full_line as we did previously.

The reason is that the slice being converted to string is not mutable; therefore, the type created will also be non-mutable. Since you cannot add to a non-mutable variable, we could not use the push and push_str methods.

主站蜘蛛池模板: 西华县| 壤塘县| 同心县| 祁东县| 新绛县| 博白县| 辽宁省| 宝应县| 长寿区| 汕尾市| 周至县| 额济纳旗| 娄底市| 万盛区| 织金县| 星座| 浦江县| 青冈县| 新津县| 田东县| 长葛市| 南汇区| 繁峙县| 灵丘县| 潼关县| 大竹县| 滁州市| 中阳县| 铜梁县| 富阳市| 阜康市| 桑植县| 赤城县| 从化市| 饶平县| 偏关县| 阳春市| 西藏| 郧西县| 洛隆县| 深水埗区|