Rust 4.1
///
/// https://kaisery.github.io/trpl-zh-cn/ch04-01-what-is-ownership.html
fn main() {
let mut s = String::from("hello");
s.push_str(",world!");
println!("{}",s);
let s1= String::from("world");
let s2 = s1.clone();
println!("s1 = {}, s2 = {}",s1,s2);
let x = 5;
let y = x;
println!("x = {}, y = {}",x,y);
}
这里记录的是所有权
本文来自博客园,作者:ukyo--BlackJesus,转载请注明原文链接:https://www.cnblogs.com/ukzq/p/18135557