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

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.

主站蜘蛛池模板: 小金县| 临漳县| 凤城市| 彭水| 定陶县| 尚志市| 廉江市| 潜山县| 东乡| 岳阳县| 桓台县| 滨州市| 安化县| 绿春县| 沐川县| 西平县| 绵阳市| 恩施市| 揭阳市| 志丹县| 桐梓县| 红原县| 江西省| 西丰县| 永宁县| 千阳县| 寻乌县| 天祝| 平顶山市| 青田县| 浦江县| 夏河县| 无棣县| 丽水市| 镇平县| 马边| 额济纳旗| 北京市| 桓台县| 光山县| 盖州市|