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

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.

主站蜘蛛池模板: 甘孜县| 崇礼县| 西贡区| 金湖县| 林西县| 涞源县| 保山市| 台州市| 广南县| 北京市| 合川市| 昌图县| 澄江县| 前郭尔| 漳平市| 名山县| 青田县| 若尔盖县| 湖口县| 普宁市| 顺平县| 恭城| 肥东县| 获嘉县| 石河子市| 绥滨县| 株洲市| 南岸区| 余庆县| 烟台市| 枣庄市| 浮梁县| 青州市| 望奎县| 海伦市| 西藏| 昭苏县| 昌宁县| 会昌县| 江达县| 通山县|