- Learning Rust
- Paul Johnson Vesa Kaihlavirta
- 90字
- 2021-07-02 23:07:17
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.
推薦閱讀
- TypeScript入門與實戰
- 垃圾回收的算法與實現
- C語言程序設計基礎與實驗指導
- Windows Presentation Foundation Development Cookbook
- 小程序,巧運營:微信小程序運營招式大全
- Easy Web Development with WaveMaker
- Mastering Google App Engine
- PySide 6/PyQt 6快速開發與實戰
- Mastering ROS for Robotics Programming
- Babylon.js Essentials
- .NET Standard 2.0 Cookbook
- 零基礎學C語言(第4版)
- Practical Predictive Analytics
- jQuery從入門到精通(微課精編版)
- Mastering Leap Motion