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

  • Learning Rust
  • Paul Johnson Vesa Kaihlavirta
  • 91字
  • 2021-07-02 23:07:16

Strings

Typically, a string can be defined in one of two ways:

let myName = "my name"; 

This is known as a string slice. These will be dealt with in a while.

The second way is to use String::new();. This is a String, with a capital S. It is allocated in the heap and can grow dynamically.

At this point, it would be a good idea to break with the current narrative and discuss how Rust uses memory, as it will help greatly with explaining a number of upcoming topics.

主站蜘蛛池模板: 黄梅县| 巧家县| 津市市| 农安县| 吉水县| 双辽市| 通辽市| 克山县| 黄浦区| 临潭县| 南投市| 凭祥市| 永吉县| 沙湾县| 拉萨市| 长沙县| 正镶白旗| 荥阳市| 山东| 喜德县| 汉沽区| 临颍县| 班戈县| 彩票| 吴江市| 梧州市| 塘沽区| 根河市| 孝义市| 濉溪县| 聂荣县| 安阳县| 隆化县| 收藏| 合肥市| 永嘉县| 广安市| 巴楚县| 正宁县| 策勒县| 安塞县|